Implemented user authentication.

This commit is contained in:
2023-09-22 21:26:13 +02:00
parent 0bac17f2eb
commit 17f628739f
23 changed files with 704 additions and 326 deletions
+26 -12
View File
@@ -1,9 +1,15 @@
use chrono::{NaiveDate, NaiveTime, Weekday};
use rust_decimal::Decimal;
//use chrono::{NaiveDate, NaiveTime, Weekday};
//use rust_decimal::Decimal;
use serde::{Deserialize, Serialize};
use uuid::Uuid;
//use uuid::Uuid;
use validator::Validate;
#[derive(Serialize, Deserialize, Clone, Debug)]
pub enum ApiResponse<T> {
Data(T),
Error(String)
}
#[derive(Clone, Serialize, Deserialize, Debug, PartialEq, Eq, Validate, Default)]
#[cfg_attr(feature = "ssr", derive(sqlx::FromRow))]
pub struct Company {
@@ -24,17 +30,25 @@ impl Company {
}
}
#[derive(Clone, Serialize, Deserialize, Debug, PartialEq, Eq, Validate, Default)]
#[cfg_attr(feature = "ssr", derive(sqlx::FromRow))]
pub struct User {
id: u16,
login: String,
password: String,
full_name: String,
email: String,
admin: bool,
get_emails: bool,
id: i32,
pub login: String,
pub password: String,
pub full_name: Option<String>,
pub email: Option<String>,
pub admin: bool,
pub get_emails: bool,
}
pub struct Property {
impl User {
pub fn id(&self) -> i32 {
self.id
}
}
/*pub struct Property {
id: u16,
name: String,
description: String,
@@ -92,4 +106,4 @@ pub struct ReservationSum {
customer: Customer,
price: Decimal,
state: ReservationState,
}
}*/