Files
DarkflameServer/dDashboardServer/DashboardHelpers.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

34 lines
1.2 KiB
C++

#include "DashboardHelpers.h"
namespace DashboardHelpers {
DataTablesParams ParseDataTablesParams(const crow::request& req) {
DataTablesParams p;
try {
if (req.url_params.get("draw")) p.draw = std::stoi(req.url_params.get("draw"));
if (req.url_params.get("start")) p.start = std::stoi(req.url_params.get("start"));
if (req.url_params.get("length")) p.length = std::stoi(req.url_params.get("length"));
if (req.url_params.get("order[0][column]")) p.orderColumn = std::stoi(req.url_params.get("order[0][column]"));
if (req.url_params.get("order[0][dir]")) p.orderDir = req.url_params.get("order[0][dir]");
} catch (...) {
// ignore parse errors, return defaults
}
return p;
}
crow::json::wvalue CreateDataTablesResponse(int draw, uint32_t recordsTotal, uint32_t recordsFiltered, const crow::json::wvalue::list& data) {
crow::json::wvalue resp;
resp["draw"] = draw;
resp["recordsTotal"] = recordsTotal;
resp["recordsFiltered"] = recordsFiltered;
resp["data"] = data;
return resp;
}
bool RescueCharacter(const uint64_t characterId, const uint32_t zoneId) {
// Minimal stub: not implemented here. Return false to indicate no-op.
return false;
}
} // namespace DashboardHelpers