You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

95 lines
1.7 KiB
Rust

use chrono::{NaiveDate, NaiveTime, Weekday};
use rust_decimal::Decimal;
use serde::{Deserialize, Serialize};
use uuid::Uuid;
use validator::Validate;
#[derive(Clone, Serialize, Deserialize, Debug, PartialEq, Eq, Validate, Default)]
#[cfg_attr(feature = "ssr", derive(sqlx::FromRow))]
pub struct Company {
id: i32,
#[validate(length(min = 1,message = "Name cannot be empty"))]
pub name: String,
#[validate(length(min = 1,message = "Street cannot be empty"))]
pub street: String,
#[validate(length(min = 1,message = "House number cannot be empty"))]
pub house_number: String,
pub zip_code: String,
pub city: String,
}
impl Company {
pub fn id(&self) -> i32 {
self.id
}
}
pub struct User {
id: u16,
login: String,
password: String,
full_name: String,
email: String,
admin: bool,
get_emails: bool,
}
pub struct Property {
id: u16,
name: String,
description: String,
price: Decimal
}
pub enum MessageType {
NewReservation,
NewReservationCust,
ReservationApp,
ReservationCanceled,
}
pub struct Message {
id: u16,
msg_type: MessageType,
subject: String,
text: String,
}
pub struct OpeningHour {
id: u16,
day: Weekday,
from: NaiveTime,
to: NaiveTime,
discount: u8
}
pub struct Customer {
id: u128,
full_name: String,
email: String,
phone: String,
discount: u8
}
pub enum ReservationState {
New,
Approved,
Canceled,
}
pub struct Reservation {
id: u128,
from: NaiveTime,
to: NaiveTime,
property: Property,
}
pub struct ReservationSum {
id: u128,
uuid: Uuid,
date: NaiveDate,
items: Vec<Reservation>,
customer: Customer,
price: Decimal,
state: ReservationState,
}