Saving functionality is looking better
This commit is contained in:
parent
3e1e46ce2b
commit
a99e4fb3cf
15 changed files with 421 additions and 54 deletions
|
@ -1,6 +1,7 @@
|
|||
use crate::model::Model;
|
||||
use color_eyre::eyre::Result;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sqlx::query_as;
|
||||
use sqlx::{query_as, SqliteConnection};
|
||||
use std::path::PathBuf;
|
||||
use tracing::error;
|
||||
|
||||
|
@ -31,6 +32,12 @@ impl Model<Video> {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
pub async fn get_video_from_db(database_id: i32, db: &mut SqliteConnection) -> Result<Video> {
|
||||
Ok(query_as!(Video, r#"SELECT title as "title!", filePath as "path!", startTime as "start_time!: f32", endTime as "end_time!: f32", loop as "looping!", id as "id: i32" from videos where id = ?"#, database_id).fetch_one(db).await?)
|
||||
}
|
||||
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue