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

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