diff options
| author | Kit La Touche <kit@transneptune.net> | 2024-10-23 21:56:31 -0400 |
|---|---|---|
| committer | Kit La Touche <kit@transneptune.net> | 2024-10-23 21:56:31 -0400 |
| commit | 1f769855df2d9cf2bca883a0475670f227e3678b (patch) | |
| tree | 6c94d9c868eb022588a07245df978478034ac5dd /src/invite/routes/post.rs | |
| parent | 8f360dd9cc45bb14431238ccc5e3d137c020fa7b (diff) | |
| parent | 461814e5174cef1be3e07b4e4069314e9bcbedd6 (diff) | |
Merge branch 'main' into wip/mobile
Diffstat (limited to 'src/invite/routes/post.rs')
| -rw-r--r-- | src/invite/routes/post.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/invite/routes/post.rs b/src/invite/routes/post.rs new file mode 100644 index 0000000..eb7d706 --- /dev/null +++ b/src/invite/routes/post.rs @@ -0,0 +1,19 @@ +use axum::extract::{Json, State}; + +use crate::{ + app::App, clock::RequestedAt, error::Internal, invite::Invite, token::extract::Identity, +}; + +pub async fn handler( + State(app): State<App>, + RequestedAt(issued_at): RequestedAt, + identity: Identity, + _: Json<Request>, +) -> Result<Json<Invite>, Internal> { + let invite = app.invites().create(&identity.login, &issued_at).await?; + Ok(Json(invite)) +} + +// Require `{}` as the only valid request for this endpoint. +#[derive(Default, serde::Deserialize)] +pub struct Request {} |
