extra_extensions as vec
This commit is contained in:
parent
5e6f2ee4a1
commit
c4f803da11
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -982,7 +982,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ffplayout-api"
|
||||
version = "0.8.3"
|
||||
version = "0.9.0"
|
||||
dependencies = [
|
||||
"actix-files",
|
||||
"actix-multipart",
|
||||
|
@ -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]
|
||||
|
@ -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<Sqlite>, channel: Channel) -> Result<Cha
|
||||
.bind(channel.name)
|
||||
.bind(channel.preview_url)
|
||||
.bind(channel.config_path)
|
||||
.bind(channel.extra_extensions)
|
||||
.bind(channel.extra_extensions.join(","))
|
||||
.bind(channel.service)
|
||||
.execute(conn)
|
||||
.await?;
|
||||
|
@ -1,4 +1,5 @@
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sqlx::{sqlite::SqliteRow, FromRow, Row};
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize, sqlx::FromRow)]
|
||||
pub struct User {
|
||||
@ -58,17 +59,34 @@ pub struct TextPreset {
|
||||
pub alpha: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize, sqlx::FromRow)]
|
||||
#[derive(Debug, Deserialize, Serialize, sqlx::Type)]
|
||||
pub struct Channel {
|
||||
#[serde(skip_deserializing)]
|
||||
pub id: i32,
|
||||
pub name: String,
|
||||
pub preview_url: String,
|
||||
pub config_path: String,
|
||||
pub extra_extensions: String,
|
||||
pub extra_extensions: Vec<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,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user