summaryrefslogtreecommitdiff
path: root/src/push/handlers/ping/mod.rs
blob: 2a86984627beb505682bc630e5c436611955d21a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
use axum::{Json, extract::State, http::StatusCode};

use crate::{
    error::Internal,
    push::{Publish, app::Push},
    token::extract::Identity,
};

#[cfg(test)]
mod test;

#[derive(serde::Deserialize)]
pub struct Request {}

pub async fn handler<P>(
    State(push): State<Push<P>>,
    identity: Identity,
    Json(_): Json<Request>,
) -> Result<StatusCode, Internal>
where
    P: Publish,
{
    push.ping(&identity.login).await?;

    Ok(StatusCode::ACCEPTED)
}