From 469a3ad33914f7eff6edc9ca7fabb12f2950da84 Mon Sep 17 00:00:00 2001 From: cel 🌸 Date: Thu, 14 Nov 2024 17:59:21 +0000 Subject: database work --- src/artwork.rs | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'src/artwork.rs') 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, + id: Option, /// name of the artwork - title: Option, + pub title: Option, /// description of the artwork - description: Option, + pub description: Option, /// source url of the artwork - url_source: Option, + pub url_source: Option, + /// artwork creation time + created_at: Option, /// id of the artist - artist_id: usize, + #[sqlx(Flatten)] + pub artist: Artist, /// ids of files - files: Vec, + #[sqlx(Flatten)] + pub files: Vec, + // /// TODO: comments in thread, + // #[sqlx(Flatten)] + // comments: Vec, } -- cgit