note the way

This commit is contained in:
Chris Cochrun 2026-04-06 16:48:07 -05:00
parent fbc4606471
commit 1f38ca9406
3 changed files with 14 additions and 18 deletions

View file

@ -159,21 +159,21 @@ impl Model<Image> {
pub async fn append_image(
&mut self,
image: Image,
db: PoolConnection<Sqlite>,
db: &SqlitePool,
) -> Result<()> {
todo!()
}
pub async fn new_image(
&mut self,
db: PoolConnection<Sqlite>,
db: &SqlitePool,
) -> Result<Image> {
todo!()
}
pub async fn update_image(
&mut self,
image: Image,
db: PoolConnection<Sqlite>,
db: &SqlitePool,
) -> Result<()> {
let id = image.id;
self.update_item(image.clone(), |current_image| {
@ -184,7 +184,6 @@ impl Model<Image> {
.to_str()
.map(std::string::ToString::to_string)
.unwrap_or_default();
let mut db = db.detach();
debug!(?image, "should be been updated");
let result = query!(
r#"UPDATE images SET title = $2, file_path = $3 WHERE id = $1"#,
@ -192,7 +191,7 @@ impl Model<Image> {
image.title,
path,
)
.execute(&mut db)
.execute(db)
.await.into_diagnostic();
match result {
@ -210,11 +209,11 @@ impl Model<Image> {
pub async fn remove_image(
&mut self,
id: i32,
db: PoolConnection<Sqlite>,
db: &SqlitePool,
) -> Result<()> {
self.remove_item(|image| image.id == id)?;
query!("DELETE FROM images WHERE id = $1", id)
.execute(&mut db.detach())
.execute(db)
.await
.into_diagnostic()
.map(|_| ())

View file

@ -301,14 +301,14 @@ impl Model<Presentation> {
pub async fn append_presentation(
&mut self,
presentation: Presentation,
db: PoolConnection<Sqlite>,
db: &SqlitePool,
) -> Result<()> {
todo!()
}
pub async fn new_presentation(
&mut self,
db: PoolConnection<Sqlite>,
db: &SqlitePool,
) -> Result<()> {
todo!()
}
@ -316,14 +316,14 @@ impl Model<Presentation> {
pub async fn update_presentation(
&mut self,
presentation: Presentation,
db: PoolConnection<Sqlite>,
db: &SqlitePool,
) -> Result<()> {
todo!()
}
pub async fn remove_presentation(
&mut self,
id: i32,
db: PoolConnection<Sqlite>,
db: &SqlitePool,
) -> Result<()> {
todo!()
}

View file

@ -201,22 +201,19 @@ impl Model<Video> {
pub async fn append_video(
&mut self,
video: Video,
db: PoolConnection<Sqlite>,
db: &SqlitePool,
) -> Result<()> {
todo!()
}
pub async fn new_video(
&mut self,
db: PoolConnection<Sqlite>,
) -> Result<()> {
pub async fn new_video(&mut self, db: &SqlitePool) -> Result<()> {
todo!()
}
pub async fn update_video(
&mut self,
video: Video,
db: PoolConnection<Sqlite>,
db: &SqlitePool,
) -> Result<()> {
todo!()
}
@ -224,7 +221,7 @@ impl Model<Video> {
pub async fn remove_video(
&mut self,
id: i32,
db: PoolConnection<Sqlite>,
db: &SqlitePool,
) -> Result<()> {
todo!()
}