mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-15 23:12:04 +00:00
refactor(types): move BackupRow and BackupsList out of route handler into src/types/backups.ts
Resolves the single component → route-handler import in the codebase (`components/admin/backups-section.tsx ← app/api/admin/backups/route.ts`) flagged by the v1.4.39 org audit (recommendation #2). The DTOs now live in `src/types/backups.ts`; the route handler keeps owning the HTTP contract and re-imports the shared types from there.
This commit is contained in:
1 parent
4cca62dce9
commit
bba38b8c66
6 files changed
+52
-28
No files matched your search
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* v1.4.41 W-ORG (org-audit rec #2) — DTOs for `/api/admin/backups`.
|
||||
*
|
||||
* Pre-v1.4.41 these interfaces lived inside the route handler at
|
||||
* `src/app/api/admin/backups/route.ts` and were imported directly from
|
||||
* the route module by `src/components/admin/backups-section.tsx`. That
|
||||
* was a textbook layer violation (component → route handler) and the
|
||||
* only one of its kind in the codebase. Hoisting the shapes here gives
|
||||
* both sides a route-handler-independent shared type home; the route
|
||||
* keeps owning the HTTP contract, the component keeps owning the UI.
|
||||
*/
|
||||
|
||||
export interface BackupRow {
|
||||
id: string;
|
||||
userId: string;
|
||||
username: string;
|
||||
type: string;
|
||||
/**
|
||||
* Size of the encrypted blob in bytes — useful for capacity planning.
|
||||
* The blob itself is never returned.
|
||||
*/
|
||||
sizeBytes: number;
|
||||
createdAt: string;
|
||||
}
|
||||
|
||||
export interface BackupsList {
|
||||
rows: BackupRow[];
|
||||
/**
|
||||
* Soft retention hint — the worker is configured for weekly backups
|
||||
* (see `DATA_BACKUP_CRON` in `src/lib/jobs/reminder-worker.ts`), and
|
||||
* the model upserts in-place per (userId, type), so each user has
|
||||
* exactly one current snapshot. The frontend uses this to label the
|
||||
* grid; no server-side enforcement.
|
||||
*/
|
||||
retentionDays: number;
|
||||
}
|
||||
Reference in new issue
Block a user