90 lines
1.9 KiB
Rust
90 lines
1.9 KiB
Rust
use std::fmt::Display;
|
|
|
|
use serde::{Deserialize, Serialize};
|
|
use sqlx::{Decode, prelude::Type};
|
|
|
|
#[derive(Deserialize, Serialize, PartialEq, Debug, sqlx::FromRow)]
|
|
pub struct Ticket {
|
|
pub id: i32,
|
|
pub category: String,
|
|
pub betreff: String,
|
|
pub description: String,
|
|
pub room: i16,
|
|
pub status: String,
|
|
pub date: chrono::NaiveDateTime,
|
|
pub user_id: i16,
|
|
}
|
|
|
|
#[derive(Deserialize, Serialize, Debug, PartialEq)]
|
|
pub struct TicketResponse {
|
|
pub id: i32,
|
|
pub category: String,
|
|
pub betreff: String,
|
|
pub description: String,
|
|
pub room: i16,
|
|
pub status: String,
|
|
pub date: chrono::NaiveDateTime,
|
|
pub user_id: i16,
|
|
}
|
|
|
|
#[derive(Deserialize, Serialize, PartialEq, Debug)]
|
|
pub struct User {
|
|
pub id: i16,
|
|
pub last_name: String,
|
|
pub first_name: String,
|
|
pub is_admin: bool,
|
|
pub pwd: String,
|
|
}
|
|
|
|
#[derive(Deserialize, Serialize, Debug)]
|
|
pub struct TicketCreateScheme {
|
|
pub category: String,
|
|
pub betreff: String,
|
|
pub description: String,
|
|
pub room: i16,
|
|
}
|
|
|
|
#[derive(Deserialize, Serialize, Debug)]
|
|
pub struct TicketUpdateScheme {
|
|
pub status: String,
|
|
}
|
|
|
|
#[derive(Deserialize, Serialize, Debug, sqlx::FromRow)]
|
|
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(Deserialize, Serialize, Debug, Clone, sqlx::FromRow)]
|
|
pub struct LoginModel {
|
|
pub id: i16,
|
|
pub last_name: String,
|
|
pub first_name: String,
|
|
pub is_admin: bool,
|
|
pub pwd: String,
|
|
}
|
|
|
|
#[derive(Debug, Serialize)]
|
|
pub struct FilteredUser {
|
|
pub id: i16,
|
|
pub first_name: String,
|
|
pub last_name: String,
|
|
pub is_admin: bool,
|
|
}
|
|
|
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
|
pub struct Claims {
|
|
pub subject: String,
|
|
pub issued: usize,
|
|
pub expires: usize,
|
|
}
|