From 3e1eadbbfdca1b2c0cb32ba4c8e1160a60e0ccb8 Mon Sep 17 00:00:00 2001 From: "Adam T. Carpenter" Date: Sat, 31 Oct 2020 10:14:31 -0400 Subject: All basic functionality implemented. --- dichroism/src/repo/entities/photo_set_form.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 dichroism/src/repo/entities/photo_set_form.rs (limited to 'dichroism/src/repo/entities/photo_set_form.rs') diff --git a/dichroism/src/repo/entities/photo_set_form.rs b/dichroism/src/repo/entities/photo_set_form.rs new file mode 100644 index 0000000..611c8f0 --- /dev/null +++ b/dichroism/src/repo/entities/photo_set_form.rs @@ -0,0 +1,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 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, + } + } +} -- cgit v1.2.3