pub trait QPaladins: ToModel + CachingModel {
    fn json_for_admin(&self) -> Result<String, Box<dyn Error>> { ... }
    fn delete_file(
        &self,
        coll: &Collection,
        model_name: &str,
        field_name: &str,
        widget_default_value: &str,
        is_image: bool
    ) -> Result<(), Box<dyn Error>> { ... } fn db_get_file_info(
        &self,
        coll: &Collection,
        field_name: &str
    ) -> Result<String, Box<dyn Error>> { ... } fn calculate_thumbnail_size(
        width: u32,
        height: u32,
        max_size: u32
    ) -> (u32, u32) { ... } fn check(&self) -> Result<OutputDataForm, Box<dyn Error>> { ... } fn save(
        &mut self,
        options_insert: Option<InsertOneOptions>,
        options_update: Option<UpdateOptions>
    ) -> Result<OutputDataForm, Box<dyn Error>> { ... } fn delete(
        &self,
        options: Option<DeleteOptions>
    ) -> Result<OutputDataForm, Box<dyn Error>> { ... } fn create_password_hash(field_value: &str) -> Result<String, Box<dyn Error>> { ... } fn verify_password(
        &self,
        password: &str,
        options: Option<FindOneOptions>
    ) -> Result<bool, Box<dyn Error>> { ... } fn update_password(
        &self,
        old_password: &str,
        new_password: &str,
        options_find_old: Option<FindOneOptions>,
        options_update: Option<UpdateOptions>
    ) -> Result<bool, Box<dyn Error>> { ... } }

Provided Methods

Json-line for admin panel. ( converts a widget map to a list, in the order of the Model fields )

Example:
let user_profile = UserProfile{...};
println!("{}", user_profile.json_for_admin()?);

Deleting a file in the database and in the file system.

Get file info from database.

Calculate the maximum size for a thumbnail.

Checking the Model before queries the database.

Example:
let user_profile  = UserProfile {...}
let result = user_profile.check()?;
assert!(result.is_valid());

Save to database as a new document or update an existing document. ( Used in conjunction with the check () method. )

Remove document from collection.

Example:
let output_data  = user.delete(None)?;
if !output_data.is_valid() {
    println!("{}", routput_data.err_msg());
}

Generate password hash and add to result document.

Example:
let user_profile = UserProfile {...};
let field_value = user_profile.password;
println!("{}", user_profile.create_password_hash(field_value)?);

Match the password from the user to the password in the database.

Example:
let user_profile = UserProfile {...};
let password = "12345678";
assert!(user_profile.create_password_hash(password, None)?);

For replace or recover password.

Example:
let user_profile = UserProfile {...};
let old_password = "12345678";
let new_password = "qBfJHCW2C9EH3_RW";
assert!(user_profile.create_password_hash(old_password, new_password, None)?);

Implementors