diff --git a/src/controllers/crate_owner_invitation.rs b/src/controllers/crate_owner_invitation.rs index 8d8653c2ac..4bfd68d52b 100644 --- a/src/controllers/crate_owner_invitation.rs +++ b/src/controllers/crate_owner_invitation.rs @@ -27,7 +27,7 @@ use std::collections::{HashMap, HashSet}; #[utoipa::path( get, path = "/api/v1/me/crate_owner_invitations", - operation_id = "list_crate_owner_invitations", + operation_id = "list_crate_owner_invitations_for_user", tag = "owners", responses((status = 200, description = "Successful Response")), )] @@ -68,7 +68,14 @@ pub async fn list(app: AppState, req: Parts) -> AppResult { })) } -/// Handles the `GET /api/private/crate_owner_invitations` route. +/// List all crate owner invitations for a crate or user. +#[utoipa::path( + get, + path = "/api/private/crate_owner_invitations", + operation_id = "list_crate_owner_invitations", + tag = "owners", + responses((status = 200, description = "Successful Response")), +)] pub async fn private_list(app: AppState, req: Parts) -> AppResult> { let mut conn = app.db_read().await?; let auth = AuthCheck::only_cookie().check(&req, &mut conn).await?; diff --git a/src/router.rs b/src/router.rs index 9559e3ea0f..24758d9240 100644 --- a/src/router.rs +++ b/src/router.rs @@ -1,5 +1,5 @@ use axum::response::IntoResponse; -use axum::routing::{delete, get, post}; +use axum::routing::{get, post}; use axum::{Json, Router}; use http::{Method, StatusCode}; use utoipa_axum::routes; @@ -53,6 +53,7 @@ pub fn build_axum_router(state: AppState) -> Router<()> { .routes(routes!(token::show, token::revoke)) .routes(routes!(token::revoke_current)) .routes(routes!(crate_owner_invitation::list)) + .routes(routes!(crate_owner_invitation::private_list)) .routes(routes!(crate_owner_invitation::handle_invite)) .routes(routes!(crate_owner_invitation::handle_invite_with_token)) .routes(routes!(user::me::update_email_notifications)) @@ -69,11 +70,6 @@ pub fn build_axum_router(state: AppState) -> Router<()> { let mut router = router // Metrics .route("/api/private/metrics/:kind", get(metrics::prometheus)) - // Crate ownership invitations management in the frontend - .route( - "/api/private/crate_owner_invitations", - get(crate_owner_invitation::private_list), - ) // Alerts from GitHub scanning for exposed API tokens .route( "/api/github/secret-scanning/verify", diff --git a/src/snapshots/crates_io__openapi__tests__openapi_snapshot.snap b/src/snapshots/crates_io__openapi__tests__openapi_snapshot.snap index ca288d969e..69b5b72cc0 100644 --- a/src/snapshots/crates_io__openapi__tests__openapi_snapshot.snap +++ b/src/snapshots/crates_io__openapi__tests__openapi_snapshot.snap @@ -20,6 +20,20 @@ snapshot_kind: text }, "openapi": "3.1.0", "paths": { + "/api/private/crate_owner_invitations": { + "get": { + "operationId": "list_crate_owner_invitations", + "responses": { + "200": { + "description": "Successful Response" + } + }, + "summary": "List all crate owner invitations for a crate or user.", + "tags": [ + "owners" + ] + } + }, "/api/private/session": { "delete": { "operationId": "end_session", @@ -514,7 +528,7 @@ snapshot_kind: text }, "/api/v1/me/crate_owner_invitations": { "get": { - "operationId": "list_crate_owner_invitations", + "operationId": "list_crate_owner_invitations_for_user", "responses": { "200": { "description": "Successful Response"