Skip to main content

max / makenotwork

665 B · 26 lines History Blame Raw
1 //! Contact sharing revocation.
2
3 use axum::{
4 extract::{Path, State},
5 http::StatusCode,
6 response::IntoResponse,
7 };
8
9 use crate::{
10 auth::AuthUser,
11 db::{self, UserId},
12 error::Result,
13 AppState,
14 };
15
16 /// Revoke contact sharing with a specific creator.
17 #[tracing::instrument(skip_all, name = "users::revoke_contact")]
18 pub(in crate::routes::api) async fn revoke_contact(
19 State(state): State<AppState>,
20 AuthUser(user): AuthUser,
21 Path(seller_id): Path<UserId>,
22 ) -> Result<impl IntoResponse> {
23 db::transactions::revoke_contact_sharing(&state.db, user.id, seller_id).await?;
24 Ok(StatusCode::NO_CONTENT)
25 }
26