Merge remote-tracking branch 'upstream/main' into rust-command-parser

This commit is contained in:
libglfw 2024-11-02 15:20:11 -07:00
commit 0bb067ffde
17 changed files with 447 additions and 79 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,