blob: 7b1b5d53189ed9f15e00ac4900c972aef5c12394 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
use std::collections::HashMap;
use crate::model::category::{Create, Update};
use crate::validation::utils::*;
pub fn create(form: &HashMap<String, String>) -> Option<Create> {
Some(Create {
name: non_empty(form, "name")?,
color: color(form, "color")?,
})
}
pub fn update(form: &HashMap<String, String>) -> Option<Update> {
Some(Update {
name: non_empty(form, "name")?,
color: color(form, "color")?,
})
}
|