document types
This commit is contained in:
@@ -48,6 +48,10 @@ use uuid::Uuid;
|
||||
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,
|
||||
@@ -83,6 +87,9 @@ use uuid::Uuid;
|
||||
schemas::DocumentAssetSummary,
|
||||
schemas::DocumentAssetDetail,
|
||||
schemas::DocumentAssetObject,
|
||||
schemas::DocumentTypeResponse,
|
||||
schemas::CreateDocumentTypeRequest,
|
||||
schemas::UpdateDocumentTypeRequest,
|
||||
schemas::DocumentCorrespondent,
|
||||
schemas::DocumentTag,
|
||||
schemas::UpdateDocumentRequest,
|
||||
@@ -132,6 +139,7 @@ use uuid::Uuid;
|
||||
(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")
|
||||
)
|
||||
@@ -576,6 +584,42 @@ mod doc {
|
||||
)]
|
||||
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}",
|
||||
@@ -773,6 +817,7 @@ pub mod schemas {
|
||||
pub query: Option<String>,
|
||||
pub tags: Option<String>,
|
||||
pub correspondents: Option<String>,
|
||||
pub document_types: Option<String>,
|
||||
#[serde(default = "default_document_status_filter")]
|
||||
#[schema(default = "active")]
|
||||
pub status: DocumentStatusFilter,
|
||||
@@ -858,6 +903,9 @@ pub mod schemas {
|
||||
pub assigned_at: String,
|
||||
}
|
||||
|
||||
pub use crate::routes::document_types::{CreateDocumentTypeRequest, UpdateDocumentTypeRequest};
|
||||
pub use crate::routes::documents::DocumentTypeResponse;
|
||||
|
||||
#[derive(Serialize, Deserialize, ToSchema)]
|
||||
pub struct DocumentResponse {
|
||||
pub id: Uuid,
|
||||
@@ -875,6 +923,10 @@ pub mod schemas {
|
||||
#[schema(nullable)]
|
||||
pub issued_at: Option<String>,
|
||||
pub metadata: Value,
|
||||
#[schema(nullable)]
|
||||
pub document_type_id: Option<Uuid>,
|
||||
#[schema(nullable)]
|
||||
pub document_type: Option<DocumentTypeResponse>,
|
||||
pub tags: Vec<DocumentTag>,
|
||||
#[serde(default, skip_serializing_if = "Vec::is_empty")]
|
||||
pub correspondents: Vec<DocumentCorrespondent>,
|
||||
@@ -909,6 +961,8 @@ pub mod schemas {
|
||||
pub issued_at: Option<Value>,
|
||||
#[schema(nullable)]
|
||||
pub metadata: Option<DocumentMetadataUpdate>,
|
||||
#[schema(nullable)]
|
||||
pub document_type_id: Option<Uuid>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, ToSchema)]
|
||||
|
||||
Reference in New Issue
Block a user