diff options
Diffstat (limited to 'src/file.rs')
-rw-r--r-- | src/file.rs | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/src/file.rs b/src/file.rs index 8a49839..15d457a 100644 --- a/src/file.rs +++ b/src/file.rs @@ -2,6 +2,32 @@ use uuid::Uuid; #[derive(sqlx::FromRow)] pub struct File { - id: Option<Uuid>, - artwork: usize, + id: Uuid, + pub alt_text: String, + extension: String, + artwork_id: Option<i32>, +} + +impl File { + pub fn new(file: std::fs::File, extension: String) -> Self { + let id = Uuid::new_v4(); + Self { + id, + alt_text: String::new(), + extension, + artwork_id: None, + } + } + + pub fn id(&self) -> Uuid { + self.id + } + + pub fn extension(&self) -> &str { + &self.extension + } + + pub fn artwork_id(&self) -> Option<i32> { + self.artwork_id + } } |