Added settings for company info. Added code for entity validation.
This commit is contained in:
+19
-6
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user