M2a: server workspace, kvitt-domain, skeleton routes, OpenAPI match, Dockerfile

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>
This commit is contained in:
2026-10-17 21:25:35 +02:00
parent c277ee37c2
commit 06f48ef9e9
71 changed files with 9187 additions and 0 deletions
@@ -0,0 +1,49 @@
//! Sync: E-31 pull and E-32 push (SPEC §14.4).
//!
//! Registered and annotated by M2a; M4 owns this file and implements the handlers (until then 501
//! `not_implemented`).
use crate::api::not_implemented;
use crate::auth::AuthDevice;
use crate::error::AppError;
use crate::openapi::responses::{BadRequest, Conflict, PayloadTooLarge, Unprocessable};
use crate::wire::{SyncLimitSchema, SyncPullResponse, SyncPushRequest, SyncPushResponse};
#[utoipa::path(
get,
path = "/sync",
operation_id = "syncPull",
summary = "E-31 Pull changes since a cursor",
description = "SPEC §14.4.2.",
params(
("since" = i64, Query, description = "The highest `server_version` the phone has applied (0 initially)."),
("limit" = Option<SyncLimitSchema>, Query, description = "Rows per page, 1 to 1000 (`invalid_request` otherwise)."),
),
responses(
(status = 200, description = "One page. Every array is present (possibly empty) and sorted by `server_version`.", body = SyncPullResponse, content_type = "application/json; charset=utf-8"),
(status = 400, response = BadRequest),
(status = 409, response = Conflict),
)
)]
pub async fn sync_pull(_device: AuthDevice) -> AppError {
not_implemented()
}
#[utoipa::path(
post,
path = "/sync",
operation_id = "syncPush",
summary = "E-32 Push local expense and settlement changes",
description = "SPEC §14.4.3 and §14.4.4. 1 to 100 mutations, body at most 1 MiB. One result per mutation, in request order.",
request_body(content = SyncPushRequest, content_type = "application/json; charset=utf-8"),
responses(
(status = 200, description = "Per-mutation results.", body = SyncPushResponse, content_type = "application/json; charset=utf-8"),
(status = 400, response = BadRequest),
(status = 409, response = Conflict),
(status = 413, response = PayloadTooLarge),
(status = 422, response = Unprocessable),
)
)]
pub async fn sync_push(_device: AuthDevice) -> AppError {
not_implemented()
}