forge
Explore
Log in

Don't you dare go Hollow

hezarfen_backend

Clone
★ 0

0 watching0 forksRust8.3 MiB6d68754Ahmet Kaan Gümüş2 months ago566 commits

solution_image.rs23 lines, 881 bytesHistoryRawDownload
1//! Solution-photo funnels: the read doors the web layer takes for the blob
2//! endpoints and the page bucketing. The writes do not pass through here —
3//! they are the solution's own transactions in
4//! [`crate::service::solution`] (`set_image`/`clear_image`/`delete`).
5
6use crate::database::Database;
7use crate::db;
8use crate::domain::solution::SolutionId;
9use crate::domain::solution_image::SolutionImage;
10use crate::error::AppError;
11
12/// The solution's photo row, if any.
13pub async fn read(db: &Database, solution: &SolutionId) -> Result<Option<SolutionImage>, AppError> {
14 db::solution_image::read(db, solution).await
15}
16
17/// The photo rows of a page of solutions, in one query.
18pub async fn list_for_solutions(
19 db: &Database,
20 solutions: &[&SolutionId],
21) -> Result<Vec<SolutionImage>, AppError> {
22 db::solution_image::list_for_solutions(db, solutions).await
23}