diff --git a/migrations/2020-05-14-213742_create_database/up.sql b/migrations/2020-05-14-213742_create_database/up.sql index 78e00818421fbca1885e8850bf2b7e9d2cd54f90..b1555d446359180fa0e95470478742b3a20871f6 100644 --- a/migrations/2020-05-14-213742_create_database/up.sql +++ b/migrations/2020-05-14-213742_create_database/up.sql @@ -131,6 +131,7 @@ create table if not exists title_images constraint title_images_pkey primary key, kind text not null, + language text not null, mime text not null, src text not null, created_at timestamp with time zone not null, diff --git a/src/dto.rs b/src/dto.rs index 96d5a4f638cebd611857a9e72000b99aa8e71f2b..156a3e687823315df44eef5e28ad14e09cbc9728 100644 --- a/src/dto.rs +++ b/src/dto.rs @@ -197,6 +197,7 @@ impl InstalmentDto { #[serde(rename_all = "camelCase")] pub struct ImageDto { pub kind: String, + pub language: Option<String>, pub mime: String, pub src: String, } @@ -205,6 +206,7 @@ impl ImageDto { pub fn of(src: TitleImage, config: &Config) -> Result<Self, url::ParseError> { Ok(ImageDto { kind: src.kind, + language: src.language, mime: src.mime, src: absolute_url(config, UrlKind::Static, src.src)?, }) diff --git a/src/models.rs b/src/models.rs index 46763aafbbfca3a10ad7bba83cb9e80b56dfacc7..98a9cefffc6b85eef1642ba6792ca810362062f7 100644 --- a/src/models.rs +++ b/src/models.rs @@ -86,6 +86,7 @@ pub struct TitleGenre { pub struct TitleImage { pub id: uuid::Uuid, pub kind: String, + pub language: Option<String>, pub mime: String, pub src: String, pub created_at: chrono::DateTime<chrono::Utc>, diff --git a/src/schema.rs b/src/schema.rs index 539557a3f52240a65c9b22b3bc3af4dd504ebbb0..034308c8c2c869fb9cb8f08cfa06fb8ac9140ba1 100644 --- a/src/schema.rs +++ b/src/schema.rs @@ -72,6 +72,7 @@ table! { title_images (id) { id -> Uuid, kind -> Text, + language -> Nullable<Text>, mime -> Text, src -> Text, created_at -> Timestamptz,