diff --git a/autoendpoint/src/routes/registration.rs b/autoendpoint/src/routes/registration.rs index 5514e2e73..c57b95823 100644 --- a/autoendpoint/src/routes/registration.rs +++ b/autoendpoint/src/routes/registration.rs @@ -77,6 +77,17 @@ pub async fn register_uaid_route( }))) } +/// Handle the `DELETE /v1/{router_type}/{app_id}/registration/{uaid}` route +pub async fn unregister_user_route( + _auth: AuthorizationCheck, + path_args: RegistrationPathArgsWithUaid, + state: Data, +) -> ApiResult { + debug!("Unregistering UAID {}", path_args.uaid); + state.ddb.remove_user(path_args.uaid).await?; + Ok(HttpResponse::Ok().finish()) +} + /// Handle the `PUT /v1/{router_type}/{app_id}/registration/{uaid}` route pub async fn update_token_route( _auth: AuthorizationCheck, diff --git a/autoendpoint/src/server.rs b/autoendpoint/src/server.rs index 4a86261e5..2fedbe5f5 100644 --- a/autoendpoint/src/server.rs +++ b/autoendpoint/src/server.rs @@ -9,7 +9,7 @@ use crate::routers::fcm::router::FcmRouter; use crate::routes::health::{health_route, lb_heartbeat_route, status_route, version_route}; use crate::routes::registration::{ get_channels_route, new_channel_route, register_uaid_route, unregister_channel_route, - update_token_route, + unregister_user_route, update_token_route, }; use crate::routes::webpush::{delete_notification_route, webpush_route}; use crate::settings::Settings; @@ -104,7 +104,8 @@ impl Server { .service( web::resource("/v1/{router_type}/{app_id}/registration/{uaid}") .route(web::put().to(update_token_route)) - .route(web::get().to(get_channels_route)), + .route(web::get().to(get_channels_route)) + .route(web::delete().to(unregister_user_route)), ) .service( web::resource("/v1/{router_type}/{app_id}/registration/{uaid}/subscription")