//! Reading review's state without reaching into its tables. //! //! The pipeline needs two facts about a candidate: the row itself, and whether //! a human approved it. It used to fetch them by calling through review's //! re-exports of db's query functions, which meant the step machine knew the //! shape of review's storage. These two calls are the whole of what it needs. use crate::db::{self, approvals, model::CandidateRow, Db}; use crate::error::Result; pub fn candidate(db: &Db, id: i64) -> Result> { 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> { approvals::for_candidate(db, candidate_id) }