Routes for auth handling

Also db and structs are now identical
This commit is contained in:
2026-04-24 19:53:43 +02:00
parent 51b6f89df2
commit 0ce17fe805
2 changed files with 9 additions and 3 deletions

View File

@@ -30,8 +30,8 @@ pub struct TicketResponse {
#[derive(Deserialize, Serialize, PartialEq, Debug)]
pub struct User {
pub id: i16,
pub first_name: String,
pub last_name: String,
pub first_name: String,
pub is_admin: bool,
pub pwd: String,
}
@@ -67,8 +67,8 @@ pub struct LoginScheme {
#[derive(Deserialize, Serialize, Debug, sqlx::FromRow)]
pub struct LoginModel {
pub id: i16,
pub first_name: String,
pub last_name: String,
pub first_name: String,
pub is_admin: bool,
pub pwd: String,
}

View File

@@ -7,7 +7,10 @@ use axum::{
use crate::{
AppState,
handlers::ticket::{create_ticket, delete_ticket, edit_ticket, get_ticket_by_id, get_tickets},
handlers::{
auth::{create_user, login, logout},
ticket::{create_ticket, delete_ticket, edit_ticket, get_ticket_by_id, get_tickets},
},
};
pub fn create_router(state: Arc<AppState>) -> Router {
@@ -20,5 +23,8 @@ pub fn create_router(state: Arc<AppState>) -> Router {
.delete(delete_ticket)
.patch(edit_ticket),
)
.route("/api/register", post(create_user))
.route("/api/login", post(login))
.route("/api/logout", get(logout))
.with_state(state)
}