Can delete member image

This commit is contained in:
2023-08-07 11:07:24 +02:00
parent c27ed56b8a
commit c6148f6562
14 changed files with 555 additions and 14 deletions

View File

@ -45,3 +45,21 @@ pub async fn create_bucket_if_required() -> anyhow::Result<()> {
Ok(())
}
/// Upload a new file to the bucket
pub async fn upload_file(path: &str, content: &[u8]) -> anyhow::Result<()> {
let bucket = AppConfig::get().s3_bucket()?;
bucket.put_object(path, content).await?;
Ok(())
}
/// Delete a file, if it exists
pub async fn delete_file_if_exists(path: &str) -> anyhow::Result<()> {
let bucket = AppConfig::get().s3_bucket()?;
bucket.delete_object(path).await?;
Ok(())
}