feat: avatar cleanup service

This commit is contained in:
alyssa 2024-10-26 03:30:58 +09:00
parent 81251282b6
commit 73c444c31d
13 changed files with 256 additions and 15 deletions

View file

@ -61,6 +61,11 @@ pub struct AvatarsConfig {
#[serde(default)]
pub migrate_worker_count: u32,
#[serde(default)]
pub cloudflare_zone_id: Option<String>,
#[serde(default)]
pub cloudflare_token: Option<String>,
}
#[derive(Deserialize, Clone, Debug)]

View file

@ -2,6 +2,13 @@ use sqlx::{PgPool, Postgres, Transaction};
use crate::db::types::avatars::*;
pub async fn get_by_id(pool: &PgPool, id: String) -> anyhow::Result<Option<ImageMeta>> {
Ok(sqlx::query_as("select * from images where id = $1")
.bind(id)
.fetch_optional(pool)
.await?)
}
pub async fn get_by_original_url(
pool: &PgPool,
original_url: &str,