41 lines
807 B
Rust
Executable File
41 lines
807 B
Rust
Executable File
// 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,
|
|
}
|