1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
use super::logic;
use crate::v0::{context::SharedContext, result::HandlerResult};
use warp::{Rejection, Reply};

pub async fn get_challenges(context: SharedContext) -> Result<impl Reply, Rejection> {
    Ok(HandlerResult(logic::get_all_challenges(context).await))
}

pub async fn get_challenge_by_id(id: i32, context: SharedContext) -> Result<impl Reply, Rejection> {
    Ok(HandlerResult(logic::get_challenge_by_id(id, context).await))
}

pub async fn get_challenge_by_id_and_group_id(
    id: i32,
    voter_group_id: String,
    context: SharedContext,
) -> Result<impl Reply, Rejection> {
    Ok(HandlerResult(
        logic::get_challenge_by_id_and_group_id(id, voter_group_id, context).await,
    ))
}