cleanup
This commit is contained in:
+67
-727
@@ -1,737 +1,64 @@
|
||||
use utoipa::openapi::{self, tag::TagBuilder, InfoBuilder};
|
||||
use utoipa::OpenApi;
|
||||
|
||||
#[derive(OpenApi)]
|
||||
#[openapi(
|
||||
paths(
|
||||
doc::health_check,
|
||||
doc::login,
|
||||
doc::signup_start,
|
||||
doc::signup_finish,
|
||||
doc::refresh,
|
||||
doc::logout,
|
||||
doc::me,
|
||||
doc::list_tenants,
|
||||
doc::select_tenant,
|
||||
doc::passkey_register_start,
|
||||
doc::passkey_register_finish,
|
||||
doc::passkey_login_start,
|
||||
doc::passkey_login_finish,
|
||||
doc::list_documents,
|
||||
doc::check_document,
|
||||
doc::upload_document,
|
||||
doc::get_document,
|
||||
doc::update_document,
|
||||
doc::delete_document,
|
||||
doc::download_with_token,
|
||||
doc::move_document,
|
||||
doc::assign_tags,
|
||||
doc::remove_tag,
|
||||
doc::bulk_move_documents,
|
||||
doc::bulk_update_tags,
|
||||
doc::bulk_assign_correspondents,
|
||||
doc::assign_correspondents,
|
||||
doc::remove_correspondent,
|
||||
doc::reanalyze_selected_documents,
|
||||
doc::list_document_assets,
|
||||
doc::request_document_assets,
|
||||
doc::get_document_asset,
|
||||
doc::create_folder,
|
||||
doc::ensure_folder_path,
|
||||
doc::get_folder,
|
||||
doc::list_folder_contents,
|
||||
doc::delete_folder,
|
||||
doc::update_folder,
|
||||
doc::list_tags,
|
||||
doc::create_tag,
|
||||
doc::update_tag,
|
||||
doc::delete_tag,
|
||||
doc::list_document_types,
|
||||
doc::create_document_type,
|
||||
doc::update_document_type,
|
||||
doc::delete_document_type,
|
||||
doc::list_correspondents,
|
||||
doc::create_correspondent,
|
||||
doc::update_correspondent,
|
||||
doc::delete_correspondent,
|
||||
doc::list_webdav_tokens,
|
||||
doc::create_webdav_token,
|
||||
doc::delete_webdav_token,
|
||||
doc::list_passkeys,
|
||||
doc::delete_passkey,
|
||||
),
|
||||
components(
|
||||
schemas(
|
||||
schemas::LoginRequest,
|
||||
schemas::SignupStartRequest,
|
||||
schemas::SignupStartResponse,
|
||||
schemas::SignupFinishRequest,
|
||||
schemas::LoginResponse,
|
||||
schemas::LoginResponseVariants,
|
||||
schemas::TenantSnippet,
|
||||
schemas::TenantSelectionResponse,
|
||||
schemas::TenantSelectionRequest,
|
||||
schemas::TenantListResponse,
|
||||
schemas::RegistrationChallengeResponse,
|
||||
schemas::AuthenticationChallengeResponse,
|
||||
schemas::PasskeySummary,
|
||||
schemas::PasskeyRegistrationFinishPayload,
|
||||
schemas::PasskeyLoginStartPayload,
|
||||
schemas::PasskeyLoginFinishPayload,
|
||||
schemas::DocumentListQuery,
|
||||
schemas::DocumentStatusFilter,
|
||||
schemas::DocumentResponse,
|
||||
schemas::DocumentDetailResponse,
|
||||
schemas::DocumentMetadataUpdate,
|
||||
schemas::DocumentVersionResponse,
|
||||
schemas::DocumentVersionDetailResponse,
|
||||
schemas::DocumentAssetResponse,
|
||||
schemas::DocumentAssetDetailResponse,
|
||||
schemas::DocumentAssetObjectResponse,
|
||||
schemas::DocumentTypeResponse,
|
||||
schemas::CreateDocumentTypeRequest,
|
||||
schemas::UpdateDocumentTypeRequest,
|
||||
schemas::DocumentCorrespondentResponse,
|
||||
schemas::TagResponse,
|
||||
schemas::UpdateDocumentRequest,
|
||||
schemas::RestoreDocumentRequest,
|
||||
schemas::BulkMoveRequest,
|
||||
schemas::BulkMoveResponse,
|
||||
schemas::AssignTagsRequest,
|
||||
schemas::MoveDocumentRequest,
|
||||
schemas::BulkTagAction,
|
||||
schemas::BulkTagRequest,
|
||||
schemas::BulkTagResponse,
|
||||
schemas::CorrespondentAssignmentInput,
|
||||
schemas::AssignCorrespondentsRequest,
|
||||
schemas::BulkCorrespondentAction,
|
||||
schemas::BulkCorrespondentsRequest,
|
||||
schemas::BulkCorrespondentResponse,
|
||||
schemas::BulkReanalyzeSelectionRequest,
|
||||
schemas::BulkReanalyzeResponse,
|
||||
schemas::AssetRequestQuery,
|
||||
schemas::AssetObjectsQuery,
|
||||
schemas::DocumentCheckQuery,
|
||||
schemas::DocumentCheckResponse,
|
||||
schemas::UploadDocumentForm,
|
||||
schemas::CreateFolderRequest,
|
||||
schemas::EnsureFolderPathRequest,
|
||||
schemas::FolderInfo,
|
||||
schemas::FolderResponse,
|
||||
schemas::FolderContentsQuery,
|
||||
schemas::FolderContentsResponse,
|
||||
schemas::UpdateFolderRequest,
|
||||
schemas::TagCatalogEntry,
|
||||
schemas::CreateTagRequest,
|
||||
schemas::UpdateTagRequest,
|
||||
schemas::CorrespondentUsage,
|
||||
schemas::CorrespondentSummary,
|
||||
schemas::CreateCorrespondentRequest,
|
||||
schemas::UpdateCorrespondentRequest,
|
||||
schemas::WebdavTokenResponse,
|
||||
schemas::WebdavTokenCreatedResponse,
|
||||
schemas::CreateWebdavTokenRequest,
|
||||
schemas::RevokePasskeyQuery,
|
||||
)
|
||||
),
|
||||
tags(
|
||||
(name = "Health", description = "Service health"),
|
||||
(name = "Auth", description = "Authentication"),
|
||||
(name = "Documents", description = "Document management"),
|
||||
(name = "Assets", description = "Document assets"),
|
||||
(name = "Folders", description = "Folder management"),
|
||||
(name = "Tags", description = "Tag catalog"),
|
||||
(name = "DocumentTypes", description = "Document type catalog"),
|
||||
(name = "Correspondents", description = "Correspondent catalog"),
|
||||
(name = "Profile", description = "User profile and WebDAV tokens")
|
||||
)
|
||||
)]
|
||||
pub struct ApiDoc;
|
||||
|
||||
#[allow(dead_code)]
|
||||
mod doc {
|
||||
use super::schemas::*;
|
||||
use uuid::Uuid;
|
||||
impl OpenApi for ApiDoc {
|
||||
fn openapi() -> openapi::OpenApi {
|
||||
let mut doc = crate::routes::health::HealthApiDoc::openapi();
|
||||
doc.merge(crate::routes::auth::AuthApiDoc::openapi());
|
||||
doc.merge(crate::routes::documents::DocumentsApiDoc::openapi());
|
||||
doc.merge(crate::routes::folders::FoldersApiDoc::openapi());
|
||||
doc.merge(crate::routes::tags::TagsApiDoc::openapi());
|
||||
doc.merge(crate::routes::document_types::DocumentTypesApiDoc::openapi());
|
||||
doc.merge(crate::routes::correspondents::CorrespondentsApiDoc::openapi());
|
||||
doc.merge(crate::routes::profile::ProfileApiDoc::openapi());
|
||||
|
||||
#[allow(dead_code)]
|
||||
fn __keep_uuid_import() {
|
||||
let _ = Uuid::nil();
|
||||
}
|
||||
doc.info = InfoBuilder::new()
|
||||
.title("Papercrate API")
|
||||
.version(env!("CARGO_PKG_VERSION"))
|
||||
.build();
|
||||
|
||||
#[utoipa::path(
|
||||
get,
|
||||
path = "/api/health",
|
||||
responses((status = 200, description = "Service is healthy")),
|
||||
tag = "Health"
|
||||
)]
|
||||
pub(super) fn health_check() {}
|
||||
doc.tags = Some(vec![
|
||||
TagBuilder::new()
|
||||
.name("Health")
|
||||
.description(Some("Service health"))
|
||||
.build(),
|
||||
TagBuilder::new()
|
||||
.name("Auth")
|
||||
.description(Some("Authentication"))
|
||||
.build(),
|
||||
TagBuilder::new()
|
||||
.name("Documents")
|
||||
.description(Some("Document management"))
|
||||
.build(),
|
||||
TagBuilder::new()
|
||||
.name("Assets")
|
||||
.description(Some("Document assets"))
|
||||
.build(),
|
||||
TagBuilder::new()
|
||||
.name("Folders")
|
||||
.description(Some("Folder management"))
|
||||
.build(),
|
||||
TagBuilder::new()
|
||||
.name("Tags")
|
||||
.description(Some("Tag catalog"))
|
||||
.build(),
|
||||
TagBuilder::new()
|
||||
.name("DocumentTypes")
|
||||
.description(Some("Document type catalog"))
|
||||
.build(),
|
||||
TagBuilder::new()
|
||||
.name("Correspondents")
|
||||
.description(Some("Correspondent catalog"))
|
||||
.build(),
|
||||
TagBuilder::new()
|
||||
.name("Profile")
|
||||
.description(Some("User profile and WebDAV tokens"))
|
||||
.build(),
|
||||
]);
|
||||
|
||||
#[utoipa::path(
|
||||
post,
|
||||
path = "/api/auth/login",
|
||||
request_body = LoginRequest,
|
||||
responses(
|
||||
(status = 200, description = "Login succeeded", body = LoginResponseVariants),
|
||||
(status = 401, description = "Invalid credentials")
|
||||
),
|
||||
tag = "Auth"
|
||||
)]
|
||||
pub(super) fn login() {}
|
||||
|
||||
#[utoipa::path(
|
||||
post,
|
||||
path = "/api/auth/signup/start",
|
||||
request_body = SignupStartRequest,
|
||||
responses(
|
||||
(status = 200, description = "Signup challenge created", body = SignupStartResponse),
|
||||
(status = 400, description = "Invalid signup request"),
|
||||
(status = 409, description = "Username already exists")
|
||||
),
|
||||
tag = "Auth"
|
||||
)]
|
||||
pub(super) fn signup_start() {}
|
||||
|
||||
#[utoipa::path(
|
||||
post,
|
||||
path = "/api/auth/signup/finish",
|
||||
request_body = SignupFinishRequest,
|
||||
responses(
|
||||
(status = 200, description = "Signup completed", body = LoginResponseVariants),
|
||||
(status = 400, description = "Invalid signup completion"),
|
||||
(status = 409, description = "Username already exists")
|
||||
),
|
||||
tag = "Auth"
|
||||
)]
|
||||
pub(super) fn signup_finish() {}
|
||||
|
||||
#[utoipa::path(
|
||||
post,
|
||||
path = "/api/auth/refresh",
|
||||
responses(
|
||||
(status = 200, description = "Refreshed access token", body = AccessTokenResponse),
|
||||
(status = 401, description = "Missing or invalid refresh token")
|
||||
),
|
||||
tag = "Auth"
|
||||
)]
|
||||
pub(super) fn refresh() {}
|
||||
|
||||
#[utoipa::path(
|
||||
post,
|
||||
path = "/api/auth/logout",
|
||||
responses((status = 204, description = "Session revoked")),
|
||||
tag = "Auth"
|
||||
)]
|
||||
pub(super) fn logout() {}
|
||||
|
||||
#[utoipa::path(
|
||||
get,
|
||||
path = "/api/auth/me",
|
||||
responses((status = 200, description = "Authenticated principal", body = AccessTokenResponse)),
|
||||
tag = "Auth"
|
||||
)]
|
||||
pub(super) fn me() {}
|
||||
|
||||
#[utoipa::path(
|
||||
get,
|
||||
path = "/api/auth/tenants",
|
||||
responses((status = 200, description = "Available tenants", body = TenantListResponse)),
|
||||
tag = "Auth"
|
||||
)]
|
||||
pub(super) fn list_tenants() {}
|
||||
|
||||
#[utoipa::path(
|
||||
post,
|
||||
path = "/api/auth/select-tenant",
|
||||
request_body = TenantSelectionRequest,
|
||||
responses((status = 200, description = "Tenant selected", body = AccessTokenResponse)),
|
||||
tag = "Auth"
|
||||
)]
|
||||
pub(super) fn select_tenant() {}
|
||||
|
||||
#[utoipa::path(
|
||||
post,
|
||||
path = "/api/auth/passkeys/register/start",
|
||||
responses((status = 200, description = "Passkey registration challenge", body = RegistrationChallengeResponse)),
|
||||
tag = "Auth"
|
||||
)]
|
||||
pub(super) fn passkey_register_start() {}
|
||||
|
||||
#[utoipa::path(
|
||||
post,
|
||||
path = "/api/auth/passkeys/register/finish",
|
||||
request_body = PasskeyRegistrationFinishPayload,
|
||||
responses((status = 200, description = "Passkey registered", body = PasskeySummary)),
|
||||
tag = "Auth"
|
||||
)]
|
||||
pub(super) fn passkey_register_finish() {}
|
||||
|
||||
#[utoipa::path(
|
||||
post,
|
||||
path = "/api/auth/passkeys/login/start",
|
||||
request_body = PasskeyLoginStartPayload,
|
||||
responses((status = 200, description = "Passkey authentication challenge", body = AuthenticationChallengeResponse)),
|
||||
tag = "Auth"
|
||||
)]
|
||||
pub(super) fn passkey_login_start() {}
|
||||
|
||||
#[utoipa::path(
|
||||
post,
|
||||
path = "/api/auth/passkeys/login/finish",
|
||||
request_body = PasskeyLoginFinishPayload,
|
||||
responses(
|
||||
(status = 200, description = "Passkey login successful", body = LoginResponseVariants),
|
||||
(status = 401, description = "Authentication failed")
|
||||
),
|
||||
tag = "Auth"
|
||||
)]
|
||||
pub(super) fn passkey_login_finish() {}
|
||||
|
||||
#[utoipa::path(
|
||||
get,
|
||||
path = "/api/documents",
|
||||
params(DocumentListQuery),
|
||||
responses((status = 200, description = "List documents", body = [DocumentResponse])),
|
||||
tag = "Documents"
|
||||
)]
|
||||
pub(super) fn list_documents() {}
|
||||
|
||||
#[utoipa::path(
|
||||
post,
|
||||
path = "/api/documents",
|
||||
request_body = UploadDocumentForm,
|
||||
responses(
|
||||
(status = 201, description = "Document created", body = DocumentDetailResponse),
|
||||
(status = 200, description = "Existing document reused", body = DocumentDetailResponse),
|
||||
(status = 204, description = "Upload skipped because the document already exists")
|
||||
),
|
||||
tag = "Documents"
|
||||
)]
|
||||
pub(super) fn upload_document() {}
|
||||
|
||||
#[utoipa::path(
|
||||
get,
|
||||
path = "/api/documents/check",
|
||||
params(DocumentCheckQuery),
|
||||
responses((status = 200, description = "Checksum lookup", body = DocumentCheckResponse)),
|
||||
tag = "Documents"
|
||||
)]
|
||||
pub(super) fn check_document() {}
|
||||
|
||||
#[utoipa::path(
|
||||
get,
|
||||
path = "/api/documents/{id}",
|
||||
params(("id" = Uuid, Path, description = "Document ID")),
|
||||
responses((status = 200, description = "Document detail", body = DocumentDetailResponse)),
|
||||
tag = "Documents"
|
||||
)]
|
||||
pub(super) fn get_document() {}
|
||||
|
||||
#[utoipa::path(
|
||||
patch,
|
||||
path = "/api/documents/{id}",
|
||||
params(("id" = Uuid, Path, description = "Document ID")),
|
||||
request_body = UpdateDocumentRequest,
|
||||
responses((status = 200, description = "Updated document", body = DocumentDetailResponse)),
|
||||
tag = "Documents"
|
||||
)]
|
||||
pub(super) fn update_document() {}
|
||||
|
||||
#[utoipa::path(
|
||||
delete,
|
||||
path = "/api/documents/{id}",
|
||||
params(("id" = Uuid, Path, description = "Document ID")),
|
||||
responses((status = 204, description = "Document deleted")),
|
||||
tag = "Documents"
|
||||
)]
|
||||
pub(super) fn delete_document() {}
|
||||
|
||||
#[utoipa::path(
|
||||
get,
|
||||
path = "/api/documents/{id}/versions",
|
||||
params(("id" = Uuid, Path, description = "Document ID")),
|
||||
responses((status = 200, description = "Document versions", body = [DocumentVersionResponse])),
|
||||
tag = "Documents"
|
||||
)]
|
||||
pub(super) fn list_document_versions() {}
|
||||
|
||||
#[utoipa::path(
|
||||
get,
|
||||
path = "/api/documents/{id}/versions/{version_id}",
|
||||
params(
|
||||
("id" = Uuid, Path, description = "Document ID"),
|
||||
("version_id" = Uuid, Path, description = "Version ID"),
|
||||
),
|
||||
responses((status = 200, description = "Document version detail", body = DocumentVersionDetailResponse)),
|
||||
tag = "Documents"
|
||||
)]
|
||||
pub(super) fn get_document_version() {}
|
||||
|
||||
#[utoipa::path(
|
||||
post,
|
||||
path = "/api/documents/{id}/restore",
|
||||
params(("id" = Uuid, Path, description = "Document ID")),
|
||||
request_body = RestoreDocumentRequest,
|
||||
responses((status = 204, description = "Document restored")),
|
||||
tag = "Documents"
|
||||
)]
|
||||
pub(super) fn restore_document() {}
|
||||
|
||||
#[utoipa::path(
|
||||
get,
|
||||
path = "/download/{token}",
|
||||
params(("token" = String, Path, description = "Download token")),
|
||||
responses((status = 302, description = "Redirect to pre-signed URL")),
|
||||
tag = "Documents"
|
||||
)]
|
||||
pub(super) fn download_with_token() {}
|
||||
|
||||
#[utoipa::path(
|
||||
patch,
|
||||
path = "/api/documents/{id}/folder",
|
||||
params(("id" = Uuid, Path, description = "Document ID")),
|
||||
request_body = MoveDocumentRequest,
|
||||
responses((status = 204, description = "Document moved")),
|
||||
tag = "Documents"
|
||||
)]
|
||||
pub(super) fn move_document() {}
|
||||
|
||||
#[utoipa::path(
|
||||
post,
|
||||
path = "/api/documents/{id}/tags",
|
||||
params(("id" = Uuid, Path, description = "Document ID")),
|
||||
request_body = AssignTagsRequest,
|
||||
responses((status = 204, description = "Tags assigned")),
|
||||
tag = "Documents"
|
||||
)]
|
||||
pub(super) fn assign_tags() {}
|
||||
|
||||
#[utoipa::path(
|
||||
delete,
|
||||
path = "/api/documents/{id}/tags/{tag_id}",
|
||||
params(
|
||||
("id" = Uuid, Path, description = "Document ID"),
|
||||
("tag_id" = Uuid, Path, description = "Tag ID")
|
||||
),
|
||||
responses((status = 204, description = "Tag removed")),
|
||||
tag = "Documents"
|
||||
)]
|
||||
pub(super) fn remove_tag() {}
|
||||
|
||||
#[utoipa::path(
|
||||
post,
|
||||
path = "/api/documents/bulk/move",
|
||||
request_body = BulkMoveRequest,
|
||||
responses((status = 200, description = "Bulk move outcome", body = BulkMoveResponse)),
|
||||
tag = "Documents"
|
||||
)]
|
||||
pub(super) fn bulk_move_documents() {}
|
||||
|
||||
#[utoipa::path(
|
||||
post,
|
||||
path = "/api/documents/bulk/tags",
|
||||
request_body = BulkTagRequest,
|
||||
responses((status = 200, description = "Bulk tag outcome", body = BulkTagResponse)),
|
||||
tag = "Documents"
|
||||
)]
|
||||
pub(super) fn bulk_update_tags() {}
|
||||
|
||||
#[utoipa::path(
|
||||
post,
|
||||
path = "/api/documents/bulk/correspondents",
|
||||
request_body = BulkCorrespondentsRequest,
|
||||
responses((status = 200, description = "Bulk correspondents outcome", body = BulkCorrespondentResponse)),
|
||||
tag = "Documents"
|
||||
)]
|
||||
pub(super) fn bulk_assign_correspondents() {}
|
||||
|
||||
#[utoipa::path(
|
||||
post,
|
||||
path = "/api/documents/{id}/correspondents",
|
||||
params(("id" = Uuid, Path, description = "Document ID")),
|
||||
request_body = AssignCorrespondentsRequest,
|
||||
responses((status = 204, description = "Correspondents assigned")),
|
||||
tag = "Documents"
|
||||
)]
|
||||
pub(super) fn assign_correspondents() {}
|
||||
|
||||
#[utoipa::path(
|
||||
delete,
|
||||
path = "/api/documents/{id}/correspondents/{correspondent_id}",
|
||||
params(
|
||||
("id" = Uuid, Path, description = "Document ID"),
|
||||
("correspondent_id" = Uuid, Path, description = "Correspondent ID")
|
||||
),
|
||||
responses((status = 204, description = "Correspondent removed")),
|
||||
tag = "Documents"
|
||||
)]
|
||||
pub(super) fn remove_correspondent() {}
|
||||
|
||||
#[utoipa::path(
|
||||
post,
|
||||
path = "/api/documents/bulk/reanalyze",
|
||||
request_body = BulkReanalyzeSelectionRequest,
|
||||
responses((status = 200, description = "Reanalyze queued", body = BulkReanalyzeResponse)),
|
||||
tag = "Documents"
|
||||
)]
|
||||
pub(super) fn reanalyze_selected_documents() {}
|
||||
|
||||
#[utoipa::path(
|
||||
get,
|
||||
path = "/api/documents/{id}/assets",
|
||||
params(("id" = Uuid, Path, description = "Document ID")),
|
||||
responses((status = 200, description = "Document assets", body = [DocumentAssetResponse])),
|
||||
tag = "Assets"
|
||||
)]
|
||||
pub(super) fn list_document_assets() {}
|
||||
|
||||
#[utoipa::path(
|
||||
post,
|
||||
path = "/api/documents/{id}/assets",
|
||||
params(
|
||||
("id" = Uuid, Path, description = "Document ID"),
|
||||
AssetRequestQuery
|
||||
),
|
||||
responses((status = 202, description = "Asset generation requested")),
|
||||
tag = "Assets"
|
||||
)]
|
||||
pub(super) fn request_document_assets() {}
|
||||
|
||||
#[utoipa::path(
|
||||
get,
|
||||
path = "/api/assets/{asset_id}",
|
||||
params(
|
||||
("asset_id" = Uuid, Path, description = "Asset ID"),
|
||||
AssetObjectsQuery
|
||||
),
|
||||
responses((status = 200, description = "Asset detail", body = DocumentAssetDetailResponse)),
|
||||
tag = "Assets"
|
||||
)]
|
||||
pub(super) fn get_document_asset() {}
|
||||
|
||||
#[utoipa::path(
|
||||
post,
|
||||
path = "/api/folders",
|
||||
request_body = CreateFolderRequest,
|
||||
responses(
|
||||
(status = 201, description = "Folder created", body = FolderResponse),
|
||||
(status = 200, description = "Folder already existed", body = FolderResponse)
|
||||
),
|
||||
tag = "Folders"
|
||||
)]
|
||||
pub(super) fn create_folder() {}
|
||||
|
||||
#[utoipa::path(
|
||||
post,
|
||||
path = "/api/folders/path",
|
||||
request_body = EnsureFolderPathRequest,
|
||||
responses((status = 200, description = "Folder path ensured", body = FolderResponse)),
|
||||
tag = "Folders"
|
||||
)]
|
||||
pub(super) fn ensure_folder_path() {}
|
||||
|
||||
#[utoipa::path(
|
||||
get,
|
||||
path = "/api/folders/{id}",
|
||||
params(("id" = Uuid, Path, description = "Folder ID")),
|
||||
responses((status = 200, description = "Folder detail", body = FolderResponse)),
|
||||
tag = "Folders"
|
||||
)]
|
||||
pub(super) fn get_folder() {}
|
||||
|
||||
#[utoipa::path(
|
||||
get,
|
||||
path = "/api/folders/{id}/contents",
|
||||
params(
|
||||
("id" = Uuid, Path, description = "Folder ID"),
|
||||
FolderContentsQuery
|
||||
),
|
||||
responses((status = 200, description = "Folder contents", body = FolderContentsResponse)),
|
||||
tag = "Folders"
|
||||
)]
|
||||
pub(super) fn list_folder_contents() {}
|
||||
|
||||
#[utoipa::path(
|
||||
delete,
|
||||
path = "/api/folders/{id}",
|
||||
params(("id" = Uuid, Path, description = "Folder ID")),
|
||||
responses((status = 204, description = "Folder deleted")),
|
||||
tag = "Folders"
|
||||
)]
|
||||
pub(super) fn delete_folder() {}
|
||||
|
||||
#[utoipa::path(
|
||||
patch,
|
||||
path = "/api/folders/{id}",
|
||||
params(("id" = Uuid, Path, description = "Folder ID")),
|
||||
request_body = UpdateFolderRequest,
|
||||
responses((status = 204, description = "Folder updated")),
|
||||
tag = "Folders"
|
||||
)]
|
||||
pub(super) fn update_folder() {}
|
||||
|
||||
#[utoipa::path(
|
||||
get,
|
||||
path = "/api/tags",
|
||||
responses((status = 200, description = "Tags", body = [TagCatalogEntry])),
|
||||
tag = "Tags"
|
||||
)]
|
||||
pub(super) fn list_tags() {}
|
||||
|
||||
#[utoipa::path(
|
||||
post,
|
||||
path = "/api/tags",
|
||||
request_body = CreateTagRequest,
|
||||
responses((status = 200, description = "Tag created", body = TagCatalogEntry)),
|
||||
tag = "Tags"
|
||||
)]
|
||||
pub(super) fn create_tag() {}
|
||||
|
||||
#[utoipa::path(
|
||||
get,
|
||||
path = "/api/document-types",
|
||||
responses((status = 200, description = "Document types", body = [DocumentTypeResponse])),
|
||||
tag = "DocumentTypes"
|
||||
)]
|
||||
pub(super) fn list_document_types() {}
|
||||
|
||||
#[utoipa::path(
|
||||
post,
|
||||
path = "/api/document-types",
|
||||
request_body = CreateDocumentTypeRequest,
|
||||
responses((status = 201, description = "Document type created", body = DocumentTypeResponse)),
|
||||
tag = "DocumentTypes"
|
||||
)]
|
||||
pub(super) fn create_document_type() {}
|
||||
|
||||
#[utoipa::path(
|
||||
patch,
|
||||
path = "/api/document-types/{id}",
|
||||
params(("id" = Uuid, Path, description = "Document type ID")),
|
||||
request_body = UpdateDocumentTypeRequest,
|
||||
responses((status = 200, description = "Document type updated", body = DocumentTypeResponse)),
|
||||
tag = "DocumentTypes"
|
||||
)]
|
||||
pub(super) fn update_document_type() {}
|
||||
|
||||
#[utoipa::path(
|
||||
delete,
|
||||
path = "/api/document-types/{id}",
|
||||
params(("id" = Uuid, Path, description = "Document type ID")),
|
||||
responses((status = 204, description = "Document type deleted")),
|
||||
tag = "DocumentTypes"
|
||||
)]
|
||||
pub(super) fn delete_document_type() {}
|
||||
|
||||
#[utoipa::path(
|
||||
patch,
|
||||
path = "/api/tags/{id}",
|
||||
params(("id" = Uuid, Path, description = "Tag ID")),
|
||||
request_body = UpdateTagRequest,
|
||||
responses((status = 200, description = "Tag updated", body = TagCatalogEntry)),
|
||||
tag = "Tags"
|
||||
)]
|
||||
pub(super) fn update_tag() {}
|
||||
|
||||
#[utoipa::path(
|
||||
delete,
|
||||
path = "/api/tags/{id}",
|
||||
params(("id" = Uuid, Path, description = "Tag ID")),
|
||||
responses((status = 204, description = "Tag deleted")),
|
||||
tag = "Tags"
|
||||
)]
|
||||
pub(super) fn delete_tag() {}
|
||||
|
||||
#[utoipa::path(
|
||||
get,
|
||||
path = "/api/correspondents",
|
||||
responses((status = 200, description = "Correspondents", body = [CorrespondentCatalogEntry])),
|
||||
tag = "Correspondents"
|
||||
)]
|
||||
pub(super) fn list_correspondents() {}
|
||||
|
||||
#[utoipa::path(
|
||||
post,
|
||||
path = "/api/correspondents",
|
||||
request_body = CreateCorrespondentRequest,
|
||||
responses((status = 200, description = "Correspondent created", body = CorrespondentCatalogEntry)),
|
||||
tag = "Correspondents"
|
||||
)]
|
||||
pub(super) fn create_correspondent() {}
|
||||
|
||||
#[utoipa::path(
|
||||
patch,
|
||||
path = "/api/correspondents/{id}",
|
||||
params(("id" = Uuid, Path, description = "Correspondent ID")),
|
||||
request_body = UpdateCorrespondentRequest,
|
||||
responses((status = 200, description = "Correspondent updated", body = CorrespondentCatalogEntry)),
|
||||
tag = "Correspondents"
|
||||
)]
|
||||
pub(super) fn update_correspondent() {}
|
||||
|
||||
#[utoipa::path(
|
||||
delete,
|
||||
path = "/api/correspondents/{id}",
|
||||
params(("id" = Uuid, Path, description = "Correspondent ID")),
|
||||
responses((status = 204, description = "Correspondent deleted")),
|
||||
tag = "Correspondents"
|
||||
)]
|
||||
pub(super) fn delete_correspondent() {}
|
||||
|
||||
#[utoipa::path(
|
||||
get,
|
||||
path = "/api/profile/webdav-tokens",
|
||||
responses((status = 200, description = "List WebDAV tokens", body = [WebdavTokenResponse])),
|
||||
tag = "Profile"
|
||||
)]
|
||||
pub(super) fn list_webdav_tokens() {}
|
||||
|
||||
#[utoipa::path(
|
||||
post,
|
||||
path = "/api/profile/webdav-tokens",
|
||||
request_body = CreateWebdavTokenRequest,
|
||||
responses((status = 201, description = "WebDAV token created", body = WebdavTokenCreatedResponse)),
|
||||
tag = "Profile"
|
||||
)]
|
||||
pub(super) fn create_webdav_token() {}
|
||||
|
||||
#[utoipa::path(
|
||||
delete,
|
||||
path = "/api/profile/webdav-tokens/{id}",
|
||||
params(("id" = Uuid, Path, description = "WebDAV token ID")),
|
||||
responses((status = 204, description = "WebDAV token revoked")),
|
||||
tag = "Profile"
|
||||
)]
|
||||
pub(super) fn delete_webdav_token() {}
|
||||
|
||||
#[utoipa::path(
|
||||
get,
|
||||
path = "/api/profile/passkeys",
|
||||
responses((status = 200, description = "List registered passkeys", body = [PasskeySummary])),
|
||||
tag = "Profile"
|
||||
)]
|
||||
pub(super) fn list_passkeys() {}
|
||||
|
||||
#[utoipa::path(
|
||||
delete,
|
||||
path = "/api/profile/passkeys/{id}",
|
||||
params(
|
||||
("id" = Uuid, Path, description = "Passkey ID"),
|
||||
("reason" = Option<String>, Query, description = "Optional reason for revoking the passkey")
|
||||
),
|
||||
responses((status = 204, description = "Passkey revoked")),
|
||||
tag = "Profile"
|
||||
)]
|
||||
pub(super) fn delete_passkey() {}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::ApiDoc;
|
||||
use utoipa::OpenApi;
|
||||
|
||||
#[test]
|
||||
fn openapi_serializes() {
|
||||
let spec = ApiDoc::openapi();
|
||||
let _ = serde_json::to_string(&spec).expect("serialize openapi");
|
||||
doc
|
||||
}
|
||||
}
|
||||
|
||||
@@ -740,6 +67,7 @@ pub mod schemas {
|
||||
AuthenticationChallengeResponse, PasskeyLoginFinishPayload, PasskeyLoginStartPayload,
|
||||
PasskeyRegistrationFinishPayload, PasskeySummary, RegistrationChallengeResponse,
|
||||
};
|
||||
pub use crate::auth::AuthenticatedUser;
|
||||
pub use crate::documents::asset::{
|
||||
DocumentAssetDetailResponse, DocumentAssetObjectResponse, DocumentAssetResponse,
|
||||
DocumentVersionDetailResponse, DocumentVersionResponse,
|
||||
@@ -775,3 +103,15 @@ pub mod schemas {
|
||||
};
|
||||
pub use crate::routes::tags::{CreateTagRequest, TagCatalogEntry, UpdateTagRequest};
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::ApiDoc;
|
||||
use utoipa::OpenApi;
|
||||
|
||||
#[test]
|
||||
fn openapi_serializes() {
|
||||
let spec = ApiDoc::openapi();
|
||||
let _ = serde_json::to_string(&spec).expect("serialize openapi");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user