diff --git a/CMakeLists.txt b/CMakeLists.txt index 5bbc72a..e77dc7c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,16 +49,8 @@ add_executable(${TARGET_NAME} src/main.cpp src/utils.hpp src/utils.cpp - src/htmx/HtmxTable.cpp - src/htmx/HtmxTable.h src/systemd.cpp src/systemd.h - src/htmx/HtmxTableRow.cpp - src/htmx/HtmxTableRow.h - src/htmx/HtmxObject.cpp - src/htmx/HtmxObject.h - src/htmx_helper.cpp - src/htmx_helper.h src/json_settings.cpp src/json_settings.h @@ -66,14 +58,6 @@ add_executable(${TARGET_NAME} src/database/database.hpp # Shadowrun - src/shadowrun/HtmxShItemList.cpp - src/shadowrun/HtmxShItemList.hpp - src/shadowrun/HtmxShAttributeList.cpp - src/shadowrun/HtmxShAttributeList.hpp - src/shadowrun/HtmxShCondition.cpp - src/shadowrun/HtmxShCondition.hpp - src/shadowrun/ShadowrunCharacterForm.hpp - src/shadowrun/ShadowrunCharacterForm.cpp src/shadowrun/ShadowrunApi.cpp src/shadowrun/ShadowrunApi.hpp src/shadowrun/ShadowrunDb.cpp @@ -82,7 +66,9 @@ add_executable(${TARGET_NAME} # login src/login/login.cpp src/login/login.hpp - + src/login/loginDb.cpp + src/login/Session.cpp + src/login/SessionHandler.cpp ) # warnings to ignore diff --git a/frontend/src/routes/+page.svelte b/frontend/src/routes/+page.svelte index 83a2db6..40ef8dc 100644 --- a/frontend/src/routes/+page.svelte +++ b/frontend/src/routes/+page.svelte @@ -1,8 +1,69 @@ - \ No newline at end of file + + + +
+ + + + \ No newline at end of file diff --git a/src/database/database.hpp b/src/database/database.hpp index eebcb9c..dd03683 100644 --- a/src/database/database.hpp +++ b/src/database/database.hpp @@ -11,6 +11,7 @@ #include "crow.h" #include "sqlite_orm.h" #include "ShadowrunDb.hpp" +#include "loginDb.hpp" class Database { @@ -84,6 +85,12 @@ private: inline auto make_database() { auto storage = sqlite_orm::make_storage(Database::dbFile, + sqlite_orm::make_table("users", + sqlite_orm::make_column("id", &login::User::id, sqlite_orm::primary_key()), + sqlite_orm::make_column("username", &login::User::username, sqlite_orm::not_null()), + sqlite_orm::make_column("password_hash", &login::User::password_hash, sqlite_orm::not_null()), + sqlite_orm::make_column("created_at", &login::User::created_at, sqlite_orm::default_value("CURRENT_TIMESTAMP")) + ), sqlite_orm::make_table("shadowrun_characters", sqlite_orm::make_column("id", &shadowrun::ShadowrunCharacter::id, sqlite_orm::primary_key()), sqlite_orm::make_column("name", &shadowrun::ShadowrunCharacter::name, sqlite_orm::not_null()), diff --git a/src/database/databasepool.h b/src/database/databasepool.h index c783763..83e70d6 100644 --- a/src/database/databasepool.h +++ b/src/database/databasepool.h @@ -36,5 +36,4 @@ private: std::condition_variable cv; }; - extern DatabasePool dbpool; \ No newline at end of file diff --git a/src/htmx/HtmxObject.cpp b/src/htmx/HtmxObject.cpp deleted file mode 100644 index 928b84f..0000000 --- a/src/htmx/HtmxObject.cpp +++ /dev/null @@ -1,11 +0,0 @@ -// -// Created by lukas on 5/11/25. -// - -#include "HtmxObject.h" - -using namespace std; - -const string& HtmxObject::htmx() const { - return html; -} \ No newline at end of file diff --git a/src/htmx/HtmxObject.h b/src/htmx/HtmxObject.h deleted file mode 100644 index 73be4e6..0000000 --- a/src/htmx/HtmxObject.h +++ /dev/null @@ -1,27 +0,0 @@ -// -// Created by lukas on 5/11/25. -// - -#ifndef HTMXOBJECT_H -#define HTMXOBJECT_H - -#include| {} | ", s); - } - html += "\ - \ - | ", endpoint, name, text); -} - -static string_view get_button_class(bool is_active) { - return is_active ? "active-button" : "inactive-button"; -} - -void HtmxTableRow::add_status_box(std::string_view name, bool is_active) { - html += format("{} | ", get_button_class(is_active), name); -} - -void HtmxTableRow::add(string_view text) { - html += format("{} | ", text); -} - -void HtmxTableRow::complete() { - html += ""; -} \ No newline at end of file diff --git a/src/htmx/HtmxTableRow.h b/src/htmx/HtmxTableRow.h deleted file mode 100644 index a95c2f3..0000000 --- a/src/htmx/HtmxTableRow.h +++ /dev/null @@ -1,28 +0,0 @@ -// -// Created by lukas on 5/11/25. -// - -#ifndef HTMXTABLEROW_H -#define HTMXTABLEROW_H - -#include
|---|