summaryrefslogtreecommitdiff
path: root/src/invite/routes/post.rs
blob: 80b1c2731dcb80daaeaa5ee6aef4f1a7d2961f22 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use axum::extract::{Json, State};

use crate::{app::App, clock::RequestedAt, error::Internal, invite::Invite, login::Login};

pub async fn handler(
    State(app): State<App>,
    RequestedAt(issued_at): RequestedAt,
    login: Login,
    // Require `{}` as the only valid request for this endpoint.
    _: Json<Request>,
) -> Result<Json<Invite>, Internal> {
    let invite = app.invites().create(&login, &issued_at).await?;
    Ok(Json(invite))
}

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