Fix to attached world data (#3618)

* Add AttachedWorldData::remove_for_world

* Box the S3 error for daedelus_client ErrorKind::S3

* Delete attached world data on world deletion
This commit is contained in:
Josiah Glosson
2025-05-06 10:06:46 -05:00
committed by GitHub
parent 8dd32bbe98
commit 2d5d2d5df8
6 changed files with 68 additions and 14 deletions

View File

@@ -62,6 +62,29 @@ impl AttachedWorldData {
})
.collect())
}
pub async fn remove_for_world(
instance: &str,
world_type: WorldType,
world_id: &str,
exec: impl sqlx::Executor<'_, Database = sqlx::Sqlite>,
) -> crate::Result<()> {
let world_type = world_type.as_str();
sqlx::query!(
"
DELETE FROM attached_world_data
WHERE profile_path = $1 and world_type = $2 and world_id = $3
",
instance,
world_type,
world_id
)
.execute(exec)
.await?;
Ok(())
}
}
macro_rules! attached_data_setter {