Ready to implement photos management
This commit is contained in:
@ -36,6 +36,13 @@ impl NumberValueConstraint {
|
||||
|
||||
#[derive(Debug, Clone, serde::Serialize)]
|
||||
pub struct StaticConstraints {
|
||||
pub date_year: NumberValueConstraint,
|
||||
pub date_month: NumberValueConstraint,
|
||||
pub date_day: NumberValueConstraint,
|
||||
|
||||
pub photo_allowed_types: &'static [&'static str],
|
||||
pub photo_max_size: usize,
|
||||
|
||||
pub mail_len: SizeConstraint,
|
||||
pub user_name_len: SizeConstraint,
|
||||
pub password_len: SizeConstraint,
|
||||
@ -53,15 +60,18 @@ pub struct StaticConstraints {
|
||||
pub member_country: SizeConstraint,
|
||||
pub member_sex: SizeConstraint,
|
||||
pub member_note: SizeConstraint,
|
||||
|
||||
pub date_year: NumberValueConstraint,
|
||||
pub date_month: NumberValueConstraint,
|
||||
pub date_day: NumberValueConstraint,
|
||||
}
|
||||
|
||||
impl Default for StaticConstraints {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
date_year: NumberValueConstraint::new(1, 2050),
|
||||
date_month: NumberValueConstraint::new(1, 12),
|
||||
date_day: NumberValueConstraint::new(1, 31),
|
||||
|
||||
photo_allowed_types: &ALLOWED_PHOTOS_MIMETYPES,
|
||||
photo_max_size: PHOTOS_MAX_SIZE,
|
||||
|
||||
mail_len: SizeConstraint::new(5, 255),
|
||||
user_name_len: SizeConstraint::new(3, 30),
|
||||
password_len: SizeConstraint::new(8, 255),
|
||||
@ -81,9 +91,6 @@ impl Default for StaticConstraints {
|
||||
member_country: SizeConstraint::new(0, 2),
|
||||
member_sex: SizeConstraint::new(0, 1),
|
||||
member_note: SizeConstraint::new(0, 35000),
|
||||
date_year: NumberValueConstraint::new(1, 2050),
|
||||
date_month: NumberValueConstraint::new(1, 12),
|
||||
date_day: NumberValueConstraint::new(1, 31),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -108,3 +115,16 @@ pub const AUTH_TOKEN_MAX_INACTIVITY: Duration = Duration::from_secs(3600);
|
||||
|
||||
/// Length of family invitation code
|
||||
pub const FAMILY_INVITATION_CODE_LEN: usize = 7;
|
||||
|
||||
/// Allowed photos mimetypes
|
||||
pub const ALLOWED_PHOTOS_MIMETYPES: [&str; 6] = [
|
||||
"image/jpeg",
|
||||
"image/png",
|
||||
"image/gif",
|
||||
"image/bmp",
|
||||
"image/webp",
|
||||
"image/vnd.microsoft.icon",
|
||||
];
|
||||
|
||||
/// Uploaded photos max size
|
||||
pub const PHOTOS_MAX_SIZE: usize = 10 * 1000 * 1000;
|
||||
|
Reference in New Issue
Block a user