From c4f803da11a709938ffaeee25935c33a96f598a0 Mon Sep 17 00:00:00 2001 From: jb-alvarado Date: Wed, 21 Dec 2022 14:11:27 +0100 Subject: [PATCH] extra_extensions as vec --- Cargo.lock | 2 +- ffplayout-api/Cargo.toml | 2 +- ffplayout-api/src/db/handles.rs | 4 ++-- ffplayout-api/src/db/models.rs | 24 +++++++++++++++++++++--- 4 files changed, 25 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0dd98c5c..8fa6b9e9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -982,7 +982,7 @@ dependencies = [ [[package]] name = "ffplayout-api" -version = "0.8.3" +version = "0.9.0" dependencies = [ "actix-files", "actix-multipart", diff --git a/ffplayout-api/Cargo.toml b/ffplayout-api/Cargo.toml index 84e4f9a7..e03cc923 100644 --- a/ffplayout-api/Cargo.toml +++ b/ffplayout-api/Cargo.toml @@ -4,7 +4,7 @@ description = "Rest API for ffplayout" license = "GPL-3.0" authors = ["Jonathan Baecker jonbae77@gmail.com"] readme = "README.md" -version = "0.8.3" +version = "0.9.0" edition = "2021" [dependencies] diff --git a/ffplayout-api/src/db/handles.rs b/ffplayout-api/src/db/handles.rs index 7aad6869..0c2e2760 100644 --- a/ffplayout-api/src/db/handles.rs +++ b/ffplayout-api/src/db/handles.rs @@ -168,7 +168,7 @@ pub async fn update_channel( .bind(channel.name) .bind(channel.preview_url) .bind(channel.config_path) - .bind(channel.extra_extensions) + .bind(channel.extra_extensions.join(",")) .execute(conn) .await } @@ -179,7 +179,7 @@ pub async fn insert_channel(conn: &Pool, channel: Channel) -> Result, pub service: String, - #[sqlx(default)] #[serde(default)] pub utc_offset: i32, } + +impl FromRow<'_, SqliteRow> for Channel { + fn from_row(row: &SqliteRow) -> sqlx::Result { + Ok(Self { + id: row.get("id"), + name: row.get("name"), + preview_url: row.get("preview_url"), + config_path: row.get("config_path"), + extra_extensions: row + .get::("extra_extensions") + .split(',') + .map(|s| s.to_string()) + .collect(), + service: row.get("service"), + utc_offset: 0, + }) + } +}