Add base server
This commit is contained in:
28
geneit_backend/src/constants.rs
Normal file
28
geneit_backend/src/constants.rs
Normal file
@ -0,0 +1,28 @@
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub struct SizeConstraint {
|
||||
min: usize,
|
||||
max: usize,
|
||||
}
|
||||
|
||||
impl SizeConstraint {
|
||||
pub fn new(min: usize, max: usize) -> Self {
|
||||
Self { min, max }
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, serde::Serialize)]
|
||||
pub struct StaticConstraints {
|
||||
pub mail_len: SizeConstraint,
|
||||
pub user_name_len: SizeConstraint,
|
||||
pub password_len: SizeConstraint,
|
||||
}
|
||||
|
||||
impl Default for StaticConstraints {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
mail_len: SizeConstraint::new(5, 255),
|
||||
user_name_len: SizeConstraint::new(3, 30),
|
||||
password_len: SizeConstraint::new(8, 255),
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user