From fe04483e7614cf7f222ad3e484cd1813a48d1c67 Mon Sep 17 00:00:00 2001 From: schn33fuchs Date: Fri, 24 Apr 2026 17:49:52 +0200 Subject: [PATCH] Updated user scheme Forgot password and username --- backend/src/models.rs | 23 +++++++++++++++++++++++ migrations/20260422094717_user_table.sql | 2 ++ 2 files changed, 25 insertions(+) diff --git a/backend/src/models.rs b/backend/src/models.rs index bbdf392..da3caa9 100644 --- a/backend/src/models.rs +++ b/backend/src/models.rs @@ -33,6 +33,7 @@ pub struct User { pub first_name: String, pub last_name: String, pub is_admin: bool, + pub pwd: String, } #[derive(Deserialize, Serialize, Debug)] @@ -47,3 +48,25 @@ pub struct TicketCreateScheme { pub struct TicketUpdateScheme { pub status: String, } + +#[derive(Deserialize, Serialize, Debug)] +pub struct UserCreateScheme { + pub first_name: String, + pub last_name: String, + pub username: String, + pub is_admin: bool, + pub pwd: String, +} + +#[derive(Deserialize, Serialize, Debug)] +pub struct LoginScheme { + pub username: String, + pub pwd: String, +} + +#[derive(Debug, Serialize, Deserialize, Clone)] +pub struct Claims { + pub subject: String, + pub issued: usize, + pub expires: usize, +} diff --git a/migrations/20260422094717_user_table.sql b/migrations/20260422094717_user_table.sql index 8682c4a..b06fbde 100644 --- a/migrations/20260422094717_user_table.sql +++ b/migrations/20260422094717_user_table.sql @@ -2,5 +2,7 @@ CREATE TABLE users ( id SMALLINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name VARCHAR(30), firstname VARCHAR(30), + username VARCHAR(30), + passwd TEXT, is_admin BOOLEAN NOT NULL DEFAULT false );