This commit is contained in:
2025-06-08 13:27:50 -04:00
commit 41c4eca4f5
18 changed files with 2656 additions and 0 deletions

40
src/auth/structs.rs Executable file
View File

@@ -0,0 +1,40 @@
// src/auth/structs.rs
use serde::{Deserialize, Serialize};
use sqlx::FromRow;
use sqlx::PgPool;
#[derive(Debug, Serialize, Deserialize, FromRow)]
pub struct User {
pub id: i32,
pub username: String,
pub password: String,
pub created: String,
pub email: Option<String>,
pub last_login: Option<String>,
pub owner: Option<i32>,
}
#[derive(Debug, Clone)]
pub struct AppState {
pub db: PgPool,
pub jwt_secret: String,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct RegisterRequest {
pub username: String,
pub password: String,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct LoginRequest {
pub username: String,
pub password: String,
}
#[derive(Debug, Serialize, Deserialize)]
pub struct Claims {
pub sub: String,
pub exp: usize,
}