06f48ef9e9
Cargo workspace (kvitt-domain, kvitt-server, kvitt-import), Rust 1.99.1 pinned. kvitt-domain passes every Rust vector and adds next_occurrence_date (D-015). kvitt-server: config, SQLite pool (WAL, §8.9 pragmas), migration 0001 identical to the contract schema, error type for all 25 codes, auth extractor and protocol layer, all 33 routes (E-1/E-2 implemented, the rest 501), utoipa document equal to contracts/openapi.yaml, seams for M3/M4/M9, serve/migrate/healthcheck. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
75 lines
2.7 KiB
Rust
75 lines
2.7 KiB
Rust
//! Recurring templates: E-28 to E-30 (FR-9, SPEC §9.5).
|
|
//!
|
|
//! Registered and annotated by M2a; M3 owns this file and implements the handlers (until then 501
|
|
//! `not_implemented`).
|
|
|
|
use crate::api::{IdPath, not_implemented};
|
|
use crate::auth::AuthDevice;
|
|
use crate::error::AppError;
|
|
use crate::openapi::responses::{BadRequest, Conflict, NotFound, Unprocessable};
|
|
use crate::wire::{
|
|
CreateRecurringTemplateRequest, PatchRecurringTemplateRequest, RecurringTemplate, UuidSchema,
|
|
};
|
|
|
|
#[utoipa::path(
|
|
post,
|
|
path = "/recurring-templates",
|
|
operation_id = "createRecurringTemplate",
|
|
summary = "E-28 Create recurring template",
|
|
description = "If a period is already due (SPEC §9.5), the server generates it before responding.",
|
|
request_body(content = CreateRecurringTemplateRequest, content_type = "application/json; charset=utf-8"),
|
|
responses(
|
|
(status = 201, description = "The new template.", body = RecurringTemplate, content_type = "application/json; charset=utf-8"),
|
|
(status = 400, response = BadRequest),
|
|
(status = 409, response = Conflict),
|
|
(status = 422, response = Unprocessable),
|
|
)
|
|
)]
|
|
pub async fn create_recurring_template(_device: AuthDevice) -> AppError {
|
|
not_implemented()
|
|
}
|
|
|
|
#[utoipa::path(
|
|
patch,
|
|
path = "/recurring-templates/{template_id}",
|
|
operation_id = "patchRecurringTemplate",
|
|
summary = "E-29 Edit, pause, resume",
|
|
description = "Any subset of the E-28 fields; `split_mode` and `splits` must be sent together.",
|
|
params(
|
|
("template_id" = UuidSchema, Path, description = "Not a UUID is 404 `not_found`."),
|
|
),
|
|
request_body(content = PatchRecurringTemplateRequest, content_type = "application/json; charset=utf-8"),
|
|
responses(
|
|
(status = 200, description = "The updated template.", body = RecurringTemplate, content_type = "application/json; charset=utf-8"),
|
|
(status = 400, response = BadRequest),
|
|
(status = 404, response = NotFound),
|
|
(status = 422, response = Unprocessable),
|
|
)
|
|
)]
|
|
pub async fn patch_recurring_template(
|
|
_device: AuthDevice,
|
|
IdPath(_template_id): IdPath,
|
|
) -> AppError {
|
|
not_implemented()
|
|
}
|
|
|
|
#[utoipa::path(
|
|
delete,
|
|
path = "/recurring-templates/{template_id}",
|
|
operation_id = "deleteRecurringTemplate",
|
|
summary = "E-30 Soft delete recurring template",
|
|
params(
|
|
("template_id" = UuidSchema, Path, description = "Not a UUID is 404 `not_found`."),
|
|
),
|
|
responses(
|
|
(status = 200, description = "The tombstone.", body = RecurringTemplate, content_type = "application/json; charset=utf-8"),
|
|
(status = 404, response = NotFound),
|
|
)
|
|
)]
|
|
pub async fn delete_recurring_template(
|
|
_device: AuthDevice,
|
|
IdPath(_template_id): IdPath,
|
|
) -> AppError {
|
|
not_implemented()
|
|
}
|