Revert "extra_extensions as vec"

This reverts commit c4f803da11.
This commit is contained in:
jb-alvarado 2022-12-22 08:02:29 +01:00
parent c4f803da11
commit c57b534b7a
4 changed files with 7 additions and 25 deletions

2
Cargo.lock generated
View File

@ -982,7 +982,7 @@ dependencies = [
[[package]]
name = "ffplayout-api"
version = "0.9.0"
version = "0.8.3"
dependencies = [
"actix-files",
"actix-multipart",

View File

@ -4,7 +4,7 @@ description = "Rest API for ffplayout"
license = "GPL-3.0"
authors = ["Jonathan Baecker jonbae77@gmail.com"]
readme = "README.md"
version = "0.9.0"
version = "0.8.3"
edition = "2021"
[dependencies]

View File

@ -168,7 +168,7 @@ pub async fn update_channel(
.bind(channel.name)
.bind(channel.preview_url)
.bind(channel.config_path)
.bind(channel.extra_extensions.join(","))
.bind(channel.extra_extensions)
.execute(conn)
.await
}
@ -179,7 +179,7 @@ pub async fn insert_channel(conn: &Pool<Sqlite>, channel: Channel) -> Result<Cha
.bind(channel.name)
.bind(channel.preview_url)
.bind(channel.config_path)
.bind(channel.extra_extensions.join(","))
.bind(channel.extra_extensions)
.bind(channel.service)
.execute(conn)
.await?;

View File

@ -1,5 +1,4 @@
use serde::{Deserialize, Serialize};
use sqlx::{sqlite::SqliteRow, FromRow, Row};
#[derive(Debug, Deserialize, Serialize, sqlx::FromRow)]
pub struct User {
@ -59,34 +58,17 @@ pub struct TextPreset {
pub alpha: String,
}
#[derive(Debug, Deserialize, Serialize, sqlx::Type)]
#[derive(Debug, Deserialize, Serialize, sqlx::FromRow)]
pub struct Channel {
#[serde(skip_deserializing)]
pub id: i32,
pub name: String,
pub preview_url: String,
pub config_path: String,
pub extra_extensions: Vec<String>,
pub extra_extensions: String,
pub service: String,
#[sqlx(default)]
#[serde(default)]
pub utc_offset: i32,
}
impl FromRow<'_, SqliteRow> for Channel {
fn from_row(row: &SqliteRow) -> sqlx::Result<Self> {
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::<String, &str>("extra_extensions")
.split(',')
.map(|s| s.to_string())
.collect(),
service: row.get("service"),
utc_offset: 0,
})
}
}