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 );