summaryrefslogtreecommitdiff
path: root/dichroism/src/repo/entities/photo_set_form.rs
blob: 611c8f0ec66072e42c0413d5d5b464d8f3f91248 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
use crate::models::PhotoSet;
use crate::schema::photo_sets;

#[derive(Insertable, AsChangeset)]
#[table_name = "photo_sets"]
pub struct PhotoSetForm {
    pub id: i32,
    pub original: String,
    pub fullsize: String,
    pub base: String,
    pub thumbnail: String,
}

impl From<PhotoSet> for PhotoSetForm {
    fn from(p: PhotoSet) -> Self {
        Self {
            id: p.id.unwrap_or(-1),
            original: p.original.id,
            fullsize: p.fullsize.id,
            base: p.base.id,
            thumbnail: p.thumbnail.id,
        }
    }
}