mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-06-07 23:34:20 +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:
@@ -193,10 +193,53 @@ std::optional<IProperty::Info> SQLiteDatabase::GetPropertyInfo(const LWOOBJID id
|
||||
auto [_, propertyEntry] = ExecuteSelect(
|
||||
"SELECT id, owner_id, clone_id, name, description, privacy_option, rejection_reason, last_updated, time_claimed, reputation, mod_approved, performance_cost "
|
||||
"FROM properties WHERE id = ?;", id);
|
||||
|
||||
|
||||
if (propertyEntry.eof()) {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
return ReadPropertyInfo(propertyEntry);
|
||||
}
|
||||
|
||||
std::vector<IProperty::Info> SQLiteDatabase::GetAllProperties() {
|
||||
std::vector<IProperty::Info> out;
|
||||
auto [stmt, res] = ExecuteSelect(
|
||||
"SELECT id, owner_id, clone_id, name, description, privacy_option, rejection_reason, "
|
||||
"last_updated, time_claimed, reputation, mod_approved, performance_cost "
|
||||
"FROM properties ORDER BY id DESC;"
|
||||
);
|
||||
|
||||
while (!res.eof()) {
|
||||
out.push_back(ReadPropertyInfo(res));
|
||||
res.nextRow();
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
std::vector<IProperty::Info> SQLiteDatabase::GetPropertiesByApprovalStatus(uint32_t approved) {
|
||||
std::vector<IProperty::Info> out;
|
||||
auto [stmt, res] = ExecuteSelect(
|
||||
"SELECT id, owner_id, clone_id, name, description, privacy_option, rejection_reason, "
|
||||
"last_updated, time_claimed, reputation, mod_approved, performance_cost "
|
||||
"FROM properties WHERE mod_approved = ? ORDER BY id DESC;",
|
||||
approved
|
||||
);
|
||||
|
||||
while (!res.eof()) {
|
||||
out.push_back(ReadPropertyInfo(res));
|
||||
res.nextRow();
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
uint32_t SQLiteDatabase::GetPropertyCount() {
|
||||
auto [_, res] = ExecuteSelect("SELECT COUNT(*) as count FROM properties;");
|
||||
return res.eof() ? 0 : res.getIntField("count");
|
||||
}
|
||||
|
||||
uint32_t SQLiteDatabase::GetUnapprovedPropertyCount() {
|
||||
auto [_, res] = ExecuteSelect("SELECT COUNT(*) as count FROM properties WHERE mod_approved = 0;");
|
||||
return res.eof() ? 0 : res.getIntField("count");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user