presentations now show up and reworked some of dnd for better
Some checks are pending
/ test (push) Waiting to run

This commit is contained in:
Chris Cochrun 2025-09-29 15:21:24 -05:00
parent a3516ef70c
commit ee45a11a0f
5 changed files with 323 additions and 57 deletions

View file

@ -82,7 +82,7 @@ impl From<&Path> for Presentation {
}
impl From<&Presentation> for Value {
fn from(value: &Presentation) -> Self {
fn from(_value: &Presentation) -> Self {
Self::List(vec![Self::Symbol(Symbol("presentation".into()))])
}
}
@ -307,6 +307,38 @@ pub async fn remove_from_db(
.map(|_| ())
}
pub async fn add_presentation_to_db(
presentation: Presentation,
db: PoolConnection<Sqlite>,
id: i32,
) -> Result<()> {
let path = presentation
.path
.to_str()
.map(std::string::ToString::to_string)
.unwrap_or_default();
let html = presentation.kind == PresKind::Html;
let mut db = db.detach();
let result = query!(
r#"INSERT into presentations VALUES($1, $2, $3, $4)"#,
id,
presentation.title,
path,
html,
)
.execute(&mut db)
.await
.into_diagnostic()?;
if result.last_insert_rowid() != id as i64 {
let rowid = result.last_insert_rowid();
error!(
rowid,
id, "It appears that rowid and id aren't the same"
);
}
Ok(())
}
pub async fn update_presentation_in_db(
presentation: Presentation,
db: PoolConnection<Sqlite>,