summaryrefslogtreecommitdiff
path: root/src/invite/routes/post.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/invite/routes/post.rs')
-rw-r--r--src/invite/routes/post.rs19
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 {}