diff options
author | 2024-11-14 21:43:54 +0000 | |
---|---|---|
committer | 2024-11-14 21:43:54 +0000 | |
commit | 67b54449a1bbde257e9454419e7bb70ebc515c0f (patch) | |
tree | e23710c2d1f5d219205f26af727b478e455a0071 /src/artist.rs | |
parent | 469a3ad33914f7eff6edc9ca7fabb12f2950da84 (diff) | |
download | critch-main.tar.gz critch-main.tar.bz2 critch-main.zip |
Diffstat (limited to 'src/artist.rs')
-rw-r--r-- | src/artist.rs | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/artist.rs b/src/artist.rs index 476dad9..0ea9131 100644 --- a/src/artist.rs +++ b/src/artist.rs @@ -1,9 +1,9 @@ use crate::error::Error; use crate::Result; -#[derive(sqlx::FromRow)] +#[derive(sqlx::FromRow, sqlx::Type)] pub struct Artist { - id: Option<i32>, + artist_id: Option<i32>, pub handle: String, pub name: Option<String>, pub bio: Option<String>, @@ -11,7 +11,17 @@ pub struct Artist { } impl Artist { - pub fn id(&self) -> Option<i32> { - self.id + pub fn new(handle: String) -> Self { + Self { + artist_id: None, + handle, + name: None, + bio: None, + site: None, + } + } + + pub fn artist_id(&self) -> Option<i32> { + self.artist_id } } |