From f04c1517b56833911fbceb380e1f95760bd71835 Mon Sep 17 00:00:00 2001 From: OpenVelo Agent Date: Wed, 22 Jul 2026 14:27:40 +0000 Subject: [PATCH] docs: update documentation to OKF v0.1 format --- docs/api/admin.md | 16 ++++---- docs/architecture/key-files.md | 13 ++++--- docs/guides/admin-general-settings.md | 53 +++++++++++++-------------- docs/index.md | 7 ++-- 4 files changed, 46 insertions(+), 43 deletions(-) diff --git a/docs/api/admin.md b/docs/api/admin.md index 93d388c..f4422b6 100644 --- a/docs/api/admin.md +++ b/docs/api/admin.md @@ -1,9 +1,9 @@ --- type: api title: Admin Endpoints -description: Admin-only endpoints for user management, general settings, categories, and supporting uploads. +description: Admin-only endpoints for user management, required general settings, categories, and supporting uploads. tags: [api, admin, users, general, categories] -timestamp: 2026-07-22T12:00:00Z +timestamp: 2026-07-22T14:24:08Z --- # Endpoints @@ -46,11 +46,13 @@ removes the row. * `logo` up to 2048 chars (a public URL — uploaded separately) * `welcomeMarkdown` up to 64 000 chars * `themeKey` is one of `THEME_IDS` -* `eventStartUtc` / `eventEndUtc` are validated as ISO-8601 datetimes - (zod `string().datetime(...)`) — empty strings are explicitly allowed - to keep the event window unconfigured. `superRefine` then enforces - `eventEndUtc > eventStartUtc` and reports the issue on `eventEndUtc` - when both fields are non-empty. +* `eventStartUtc` / `eventEndUtc` must each be non-empty ISO-8601 + datetimes. Empty and malformed strings produce a field-specific + `400 VALIDATION_FAILED` issue (`eventStartUtc must be a valid ISO-8601 + datetime` or `eventEndUtc must be a valid ISO-8601 datetime`). + `superRefine` additionally requires `eventEndUtc > eventStartUtc` and + reports `eventEndUtc must be strictly after eventStartUtc` on the end + field when both values parse but are out of order. * `defaultChallengeIp` 1–255 chars * `registrationsEnabled` boolean diff --git a/docs/architecture/key-files.md b/docs/architecture/key-files.md index 8f7484f..2625452 100644 --- a/docs/architecture/key-files.md +++ b/docs/architecture/key-files.md @@ -1,9 +1,9 @@ --- type: architecture title: Key Files Index -description: One-line responsibility for important source files, including bootstrap payloads, runtime theme application, authenticated event streaming, and validated site-logo uploads. -tags: [architecture, index, key-files] -timestamp: 2026-07-22T13:40:00Z +description: One-line responsibility for important source and contract-test files, including strict event-window validation. +tags: [architecture, key-files, event-window, validation] +timestamp: 2026-07-22T14:24:08Z --- # Backend @@ -25,7 +25,9 @@ timestamp: 2026-07-22T13:40:00Z | `backend/src/modules/auth/auth.controller.ts` | Registers authentication and account endpoints. | | `backend/src/modules/auth/auth.service.ts` | Handles sessions, authentication, registration, and password changes. | | `backend/src/modules/uploads/uploads.controller.ts` | Registers admin-only multipart uploads, including Sharp-backed site-logo format validation. | -| `backend/src/modules/admin/dto/general.dto.ts` | Zod schema for `PUT /api/v1/admin/general/settings` — string-length rules, theme-key enum, ISO-8601 datetime check on the event-window fields (empty string allowed), and the `endAfterStart` super-refine. | +| `backend/src/modules/admin/dto/general.dto.ts` | Zod contract for `PUT /api/v1/admin/general/settings`; both event timestamps are required ISO-8601 values and end must be strictly after start. | +| `tests/backend/admin-general-event-window.spec.ts` | Focused contract tests for valid, empty, malformed, equal, and reversed event-window timestamps. | +| `tests/backend/admin-general-service.spec.ts` | General-settings schema and service tests, including per-field empty datetime failures and settings-event emission. | # Frontend @@ -47,7 +49,8 @@ timestamp: 2026-07-22T13:40:00Z | `frontend/src/app/features/shell/tabs/quick-tabs.component.ts` | Main shell navigation tabs. | | `frontend/src/app/features/shell/change-password/change-password-modal.component.ts` | Change-password form modal. | | `frontend/src/app/features/admin/general.component.ts` | `AdminGeneralComponent` reactive form for `/admin/general` — per-field inline error rendering (page-title + event-start + event-end), logo upload wiring, welcome Markdown preview, event-state derivation, and SSE `general` event handling. | -| `frontend/src/app/features/admin/general.pure.ts` | Pure helpers used by `AdminGeneralComponent` — `deriveEventState`, `endAfterStartValidator`, `normalizePageTitle`, `toIsoUtc`, `toDatetimeLocal`, `pageTitleError` / `pageTitleMessage`, `isoDatetimeValidator`, and `datetimeMessage`. | +| `frontend/src/app/features/admin/general.pure.ts` | Pure General Settings helpers, including required datetime validation, field messages, UTC conversion, and end-after-start validation. | +| `tests/frontend/admin-general-pure.spec.ts` | Pure client-contract tests for required event timestamps, datetime messaging, UTC conversion, and event-window ordering. | | `tests/frontend/authenticated-event-source.spec.ts` | Tests SSE authorization, frame transport behavior, and the `401`/`403` unauthorized path. | | `tests/frontend/auth-session-events.spec.ts` | Pure tests for cross-tab invalidation message encoding, payload validation, and `storage`-event filtering. | diff --git a/docs/guides/admin-general-settings.md b/docs/guides/admin-general-settings.md index 39cdc30..02f081d 100644 --- a/docs/guides/admin-general-settings.md +++ b/docs/guides/admin-general-settings.md @@ -1,9 +1,9 @@ --- type: guide title: Admin — General Settings -description: How an admin edits global platform settings (page title, logo, theme, event window, default challenge IP, registrations, welcome Markdown) from the /admin/general page. +description: How an admin edits required platform-wide settings, including the validated event window, from the /admin/general page. tags: [guide, admin, settings, general, tester, datetime, validation] -timestamp: 2026-07-22T14:07:58Z +timestamp: 2026-07-22T14:24:08Z --- # When this view is available @@ -42,8 +42,8 @@ The page is a single reactive form with these controls (every | Logo (file picker) | `general-logo-file` | `logo` (public URL) | Uploads via `POST /api/v1/uploads/logo`; the returned `publicUrl` is bound to a hidden input `general-logo`. | | Logo upload status | `general-logo-uploading` / `general-logo-error` / `general-logo-current` | — | Inline status text under the file picker. | | Global theme | `general-themeKey` | `themeKey` | `