]> saetta.ns0.it Git - rust/zakform/commitdiff
Added size min and max for FieldFile. validators
authorAndrea Zagli <azagli@libero.it>
Sun, 19 May 2024 06:49:11 +0000 (08:49 +0200)
committerAndrea Zagli <azagli@libero.it>
Sun, 19 May 2024 06:49:11 +0000 (08:49 +0200)
src/fields.rs

index ecd360bfa2c02de894d25a685cb498b4634656cf..4a694a0dabf0169c3c61689e9988e290a3633ae4 100644 (file)
@@ -2,7 +2,7 @@ use std::default::Default;
 
 use std::{any::Any, marker::{Sync, Send}};
 
-use serde_derive::{Serialize};
+use serde_derive::Serialize;
 
 #[derive(Default, Clone, Copy)]
 pub enum FieldDbType {
@@ -1268,6 +1268,8 @@ _ => {},
 pub struct FieldFile {
        field: Field,
        accept: String,
+       size_min: i32,
+       size_max: i32,
 }
 
 impl TField for FieldFile {
@@ -1436,4 +1438,20 @@ _ => {},
        pub fn set_accept(&mut self, accept: &str) {
                self.accept = String::from(accept);
        }
+
+       pub fn get_size_min(&self) -> i32 {
+               self.size_min
+       }
+
+       pub fn set_size_min(&mut self, size_min: i32) {
+               self.size_min = size_min;
+       }
+
+       pub fn get_size_max(&self) -> i32 {
+               self.size_max
+       }
+
+       pub fn set_size_max(&mut self, size_max: i32) {
+               self.size_max = size_max;
+       }
 }