storage::validation

Function validate_user_fields

Source
pub fn validate_user_fields(user: &User) -> Result<(), Error>
Expand description

Validates the fields within a user object for create/update within a store

ยงExamples

Validate the default user content. This will fail as the default User content contains some empty fields that need to be populated prior to saving to a store.

use data_model::User;
use storage::validation::validate_user_fields;
use uuid::Uuid;

let user = User::default();
match validate_user_fields(&user) {
    Ok(_) => {
        println!("The User object passed the field validation test for storage");
    }
    Err(error) => {
        println!(
            "The User object failed the field validation test for storage => {}",
            error
        );
    }
}