Files
DarkflameServer/dDatabase/GameDatabase/MySQL/Tables/DashboardConfig.cpp
Aaron Kimbrell e3467465b4 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.
2026-04-22 11:01:41 -05:00

15 lines
726 B
C++

#include "MySQLDatabase.h"
std::optional<std::string> MySQLDatabase::GetDashboardConfig(const std::string_view key) {
auto res = ExecuteSelect("SELECT config_value FROM dashboard_config WHERE config_key = ? LIMIT 1;", key);
if (res->next()) {
return res->getString("config_value").c_str();
}
return std::nullopt;
}
void MySQLDatabase::SetDashboardConfig(const std::string_view key, const std::string_view value) {
// Use INSERT ... ON DUPLICATE KEY UPDATE for MySQL
ExecuteInsert("INSERT INTO dashboard_config (config_key, config_value, updated_at) VALUES (?, ?, UNIX_TIMESTAMP()) ON DUPLICATE KEY UPDATE config_value = VALUES(config_value), updated_at = VALUES(updated_at);", key, value);
}