summaryrefslogtreecommitdiffstats
path: root/src/review/reads.rs
blob: c82d90ba3abb3831b8810dc9be19f1c52f8aff38 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//! The two facts the pipeline needs about a candidate: the row, and whether a
//! human approved it.

use crate::db::{self, approvals, model::CandidateRow, Db};
use crate::error::Result;

pub fn candidate(db: &Db, id: i64) -> Result<Option<CandidateRow>> {
    db::candidates::by_id(db, id)
}

/// The approval behind a candidate, as `(approval id, decision)`. `None` means
/// no human has decided, which is what publish refuses on.
pub fn approval(db: &Db, candidate_id: i64) -> Result<Option<(i64, String)>> {
    approvals::for_candidate(db, candidate_id)
}