Added settings for company info. Added code for entity validation.

This commit is contained in:
2023-09-08 11:53:08 +02:00
parent 44b8b21426
commit 9dd0993204
18 changed files with 488 additions and 20 deletions
+19 -6
View File
@@ -1,14 +1,27 @@
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)]
#[cfg_attr(feature = "ssr", derive(sqlx::FromRow))]
pub struct Company {
id: u16,
name: String,
street: String,
house_number: String,
zip_code: String,
city: String,
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 {