Fixes leave on the server and reworked login flow.

This commit is contained in:
2025-06-27 14:45:36 +02:00
parent fbe456a0f5
commit f0883a0ff0
31 changed files with 472 additions and 71 deletions
+10 -13
View File
@@ -6,7 +6,7 @@ use jsonwebtoken::{encode, Header, EncodingKey, decode, DecodingKey, Validation}
use serde::{Serialize, Deserialize};
use uuid::Uuid;
use gamenight_database::{user::{get_user, Role, User}, DbPool};
use gamenight_database::{user::{get_user, User}, DbPool};
use super::error::ApiError;
@@ -16,21 +16,18 @@ pub struct Claims {
uid: Uuid
}
pub struct AuthUser {
pub id: Uuid,
pub username: String,
pub email: String,
pub role: Role,
}
pub struct AuthUser(pub User);
// pub struct AuthUser {
// pub id: Uuid,
// pub username: String,
// pub email: String,
// pub role: Role,
// }
impl From<User> for AuthUser {
fn from(value: User) -> Self {
Self{
id: value.id,
username: value.username,
email: value.email,
role: value.role,
}
Self(value)
}
}