summaryrefslogtreecommitdiffstats
path: root/src/artwork.rs
diff options
context:
space:
mode:
authorLibravatar cel 🌸 <cel@blos.sm>2024-11-14 17:59:21 +0000
committerLibravatar cel 🌸 <cel@blos.sm>2024-11-14 17:59:21 +0000
commit469a3ad33914f7eff6edc9ca7fabb12f2950da84 (patch)
tree2712ba2e927fb820b6aa58443c9227d1da24a03f /src/artwork.rs
parentb7a2265e9b29d8fa09f84f5213ef7f8ed3045ca6 (diff)
downloadcritch-469a3ad33914f7eff6edc9ca7fabb12f2950da84.tar.gz
critch-469a3ad33914f7eff6edc9ca7fabb12f2950da84.tar.bz2
critch-469a3ad33914f7eff6edc9ca7fabb12f2950da84.zip
database work
Diffstat (limited to 'src/artwork.rs')
-rw-r--r--src/artwork.rs25
1 files changed, 19 insertions, 6 deletions
diff --git a/src/artwork.rs b/src/artwork.rs
index 78b39af..458fd38 100644
--- a/src/artwork.rs
+++ b/src/artwork.rs
@@ -1,14 +1,27 @@
+use time::{OffsetDateTime, PrimitiveDateTime};
+use uuid::Uuid;
+
+use crate::{artist::Artist, comment::Comment, file::File};
+
+#[derive(sqlx::FromRow)]
pub struct Artwork {
/// artwork id
- id: Option<usize>,
+ id: Option<i32>,
/// name of the artwork
- title: Option<String>,
+ pub title: Option<String>,
/// description of the artwork
- description: Option<String>,
+ pub description: Option<String>,
/// source url of the artwork
- url_source: Option<String>,
+ pub url_source: Option<String>,
+ /// artwork creation time
+ created_at: Option<PrimitiveDateTime>,
/// id of the artist
- artist_id: usize,
+ #[sqlx(Flatten)]
+ pub artist: Artist,
/// ids of files
- files: Vec<usize>,
+ #[sqlx(Flatten)]
+ pub files: Vec<File>,
+ // /// TODO: comments in thread,
+ // #[sqlx(Flatten)]
+ // comments: Vec<Comment>,
}