Skip to main content

max / makenotwork

660 B · 27 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 sqlx::PgPool;
10
11 use crate::{
12 auth::AuthUser,
13 db::{self, UserId},
14 error::Result,
15 };
16
17 /// Revoke contact sharing with a specific creator.
18 #[tracing::instrument(skip_all, name = "users::revoke_contact")]
19 pub(in crate::routes::api) async fn revoke_contact(
20 State(db): State<PgPool>,
21 AuthUser(user): AuthUser,
22 Path(seller_id): Path<UserId>,
23 ) -> Result<impl IntoResponse> {
24 db::transactions::revoke_contact_sharing(&db, user.id, seller_id).await?;
25 Ok(StatusCode::NO_CONTENT)
26 }
27