mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-05-13 19:05:04 +00:00
- 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.
16 lines
570 B
C++
16 lines
570 B
C++
#include "SQLiteDatabase.h"
|
|
|
|
std::optional<std::string> SQLiteDatabase::GetDashboardConfig(const std::string_view key) {
|
|
auto [_, result] = ExecuteSelect("SELECT config_value FROM dashboard_config WHERE config_key = ?;", key);
|
|
|
|
if (result.nextRow()) {
|
|
return result.getStringField(0);
|
|
}
|
|
|
|
return std::nullopt;
|
|
}
|
|
|
|
void SQLiteDatabase::SetDashboardConfig(const std::string_view key, const std::string_view value) {
|
|
ExecuteInsert("INSERT OR REPLACE INTO dashboard_config (config_key, config_value, updated_at) VALUES (?, ?, strftime('%s', 'now'));", key, value);
|
|
}
|