mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-06-06 23:04:21 +00:00
Add dashboard audit log and configuration management
- Implemented dashboard audit logging with InsertAuditLog, GetRecentAuditLogs, GetAuditLogsByIP, and CleanupOldAuditLogs methods. - Created dashboard configuration management with GetDashboardConfig and SetDashboardConfig methods. - Added new tables for dashboard_audit_log and dashboard_config in both MySQL and SQLite migrations. - Updated CMakeLists to include Crow and ASIO for dashboard server functionality. - Enhanced existing database classes to support new dashboard features, including character, play key, and property management. - Added new methods for retrieving and managing play keys, properties, and pet names. - Updated TestSQLDatabase to include stubs for new dashboard-related methods. - Modified shared and dashboard configuration files for new settings.
This commit is contained in:
@@ -24,3 +24,44 @@ std::optional<IPetNames::Info> MySQLDatabase::GetPetNameInfo(const LWOOBJID& pet
|
||||
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
std::vector<IPetNames::DetailedInfo> MySQLDatabase::GetAllPetNames() {
|
||||
std::vector<IPetNames::DetailedInfo> out;
|
||||
auto res = ExecuteSelect("SELECT id, pet_name, approved, owner_id FROM pet_names ORDER BY id DESC;");
|
||||
|
||||
while (res->next()) {
|
||||
IPetNames::DetailedInfo info;
|
||||
info.id = res->getUInt64("id");
|
||||
info.petName = res->getString("pet_name").c_str();
|
||||
info.approvalStatus = res->getInt("approved");
|
||||
info.ownerId = res->getUInt64("owner_id");
|
||||
out.push_back(info);
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
std::vector<IPetNames::DetailedInfo> MySQLDatabase::GetPetNamesByStatus(int32_t status) {
|
||||
std::vector<IPetNames::DetailedInfo> out;
|
||||
auto res = ExecuteSelect("SELECT id, pet_name, approved, owner_id FROM pet_names WHERE approved = ? ORDER BY id DESC;", status);
|
||||
|
||||
while (res->next()) {
|
||||
IPetNames::DetailedInfo info;
|
||||
info.id = res->getUInt64("id");
|
||||
info.petName = res->getString("pet_name").c_str();
|
||||
info.approvalStatus = res->getInt("approved");
|
||||
info.ownerId = res->getUInt64("owner_id");
|
||||
out.push_back(info);
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
void MySQLDatabase::SetPetApprovalStatus(const LWOOBJID& petId, int32_t status) {
|
||||
ExecuteUpdate("UPDATE pet_names SET approved = ? WHERE id = ?;", status, petId);
|
||||
}
|
||||
|
||||
uint32_t MySQLDatabase::GetPendingPetNamesCount() {
|
||||
auto res = ExecuteSelect("SELECT COUNT(*) as count FROM pet_names WHERE approved = 1;");
|
||||
return res->next() ? res->getUInt("count") : 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user