some debug

This commit is contained in:
Blue 2024-01-17 18:56:53 -03:00
parent 2e01fe8d67
commit 19d786631a
Signed by: blue
GPG Key ID: 9B203B252A63EE38
3 changed files with 14 additions and 10 deletions

View File

@ -23,8 +23,8 @@ constexpr const char* createSessionQuery = "INSERT INTO sessions (`owner`, `acce
" RETURNING id, owner"; " RETURNING id, owner";
constexpr const char* selectSession = "SELECT id, owner, access, renew FROM sessions where access = ?"; constexpr const char* selectSession = "SELECT id, owner, access, renew FROM sessions where access = ?";
constexpr const char* selectAssets = "SELECT id, owner, currency, title, icon, archived FROM assets where owner = ?"; constexpr const char* selectAssets = "SELECT id, owner, currency, title, icon, archived FROM assets where owner = ?";
constexpr const char* insertAsset = "INSERT INTO assets (`owner`, `currency`, `title`, `icon`, `archived`)" constexpr const char* insertAsset = "INSERT INTO assets (`owner`, `currency`, `title`, `icon`, `archived`, `type`)"
" VALUES (?, ?, ?, ?, ?)"; " VALUES (?, ?, ?, ?, ?, 1)";
static const std::filesystem::path buildSQLPath = "database"; static const std::filesystem::path buildSQLPath = "database";

View File

@ -26,8 +26,8 @@ constexpr std::array<std::string_view, static_cast<uint8_t>(Response::Status::__
}; };
constexpr std::array<std::string_view, static_cast<uint8_t>(Response::ContentType::__size)> contentTypes = { constexpr std::array<std::string_view, static_cast<uint8_t>(Response::ContentType::__size)> contentTypes = {
"Content-type: text/plain", "Content-Type: text/plain",
"Content-type: application/json" "Content-Type: application/json"
}; };
Response::Response(Request& request): Response::Response(Request& request):
@ -50,13 +50,13 @@ void Response::send() const {
// request.getErrorStream(); // request.getErrorStream();
OStream out = request.getOutputStream(); OStream out = request.getOutputStream();
out << statuses[static_cast<uint8_t>(status)]; out << statuses[static_cast<uint8_t>(status)] << "\r\n";
if (!body.empty()) if (!body.empty())
out << '\n' out << contentTypes[static_cast<uint8_t>(type)] << "\r\n"
<< contentTypes[static_cast<uint8_t>(type)] << "\r\n"
<< '\n'
<< '\n'
<< body; << body;
else
out << "\r\n";
request.responseIsComplete(); request.responseIsComplete();
} }

View File

@ -22,7 +22,11 @@ Session::Session(
timeoutId(TM::Scheduler::none), timeoutId(TM::Scheduler::none),
timeout(timeout), timeout(timeout),
mtx(), mtx(),
cache() cache({
{"system", {
{"invalidate", true}
}}
})
{} {}
Session::~Session () { Session::~Session () {