Can delete member image
This commit is contained in:
@ -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(())
|
||||
}
|
||||
|
Reference in New Issue
Block a user