Files
parking_solution/packages/db/drizzle/meta/_journal.json
T
julian 7680d9a0ed feat(recycle-bin): soft delete + restore for master data
Accidental admin deletes of users/roles/subscriptions/plans/tariffs were
hard and unrecoverable. Now they soft-delete into a recycle bin.

Schema (migration 0012): nullable deleted_at + deleted_by on users, roles,
subscriptions, subscription_plans, tariffs. Additive ADD COLUMN; verified
against a copy of the live DB.

Backend: each resource's DELETE route STAMPS instead of removing; every
catalog list filters deleted_at IS NULL. New recycle-bin module + routes
(GET /api/recycle-bin, POST .../restore, DELETE .../:id purge) gated on a
new recyclebin:read/update/delete permission. A 6-hourly + startup sweep
auto-purges items older than RECYCLE_BIN_RETENTION_DAYS (default 30; 0 =
forever).

Invariants: soft-deleted users can't log in (login rejects deleted_at;
no-lockout counts live admins only); a soft-deleted subscription doesn't
open the barrier; plans are versioned so a delete stamps all versions of
the plan_id (bin shows one item); username/role-name UNIQUE spans deleted
rows so reuse returns a clear 409 pointing at the bin; restore doesn't
auto-cascade a dangling role (guard resolves missing role to empty perms).
The signed append-only ledger is OUT of scope (no delete path).

Web: a Recycle bin tab under Setup (RecycleBin.tsx) with Restore/Purge +
purge confirm; api client + i18n (sq + en parity).

Tests: recycle-bin.test.ts (9 unit) + recycle-bin-routes.test.ts (4
integration: delete -> can't-login -> restore -> login, purge, gating,
409 reuse). server 103/103; build+lint+test 19/19.

Wiki: new concepts/soft-delete.md; local-jwt-auth + index + log updated.

Claude-Session: https://claude.ai/code/session_01Xcm6ikLgGoCxxHrxtjkk5V
2026-06-22 09:33:54 +02:00

97 lines
1.9 KiB
JSON

{
"version": "7",
"dialect": "sqlite",
"entries": [
{
"idx": 0,
"version": "6",
"when": 1781632874398,
"tag": "0000_baseline",
"breakpoints": true
},
{
"idx": 1,
"version": "6",
"when": 1781682176094,
"tag": "0001_neat_slipstream",
"breakpoints": true
},
{
"idx": 2,
"version": "6",
"when": 1781713560438,
"tag": "0002_panoramic_tiger_shark",
"breakpoints": true
},
{
"idx": 3,
"version": "6",
"when": 1781774228086,
"tag": "0003_early_hawkeye",
"breakpoints": true
},
{
"idx": 4,
"version": "6",
"when": 1781800000000,
"tag": "0004_subscriptions_rename",
"breakpoints": true
},
{
"idx": 5,
"version": "6",
"when": 1781884800000,
"tag": "0005_site_timezone",
"breakpoints": true
},
{
"idx": 6,
"version": "6",
"when": 1781884900000,
"tag": "0006_site_default_category",
"breakpoints": true
},
{
"idx": 7,
"version": "6",
"when": 1781885000000,
"tag": "0007_rbac",
"breakpoints": true
},
{
"idx": 8,
"version": "6",
"when": 1781885100000,
"tag": "0008_user_profile_theme",
"breakpoints": true
},
{
"idx": 9,
"version": "6",
"when": 1781885200000,
"tag": "0009_app_logs",
"breakpoints": true
},
{
"idx": 10,
"version": "6",
"when": 1781885300000,
"tag": "0010_subscription_plans",
"breakpoints": true
},
{
"idx": 11,
"version": "6",
"when": 1781885400000,
"tag": "0011_subscription_plan_v2",
"breakpoints": true
},
{
"idx": 12,
"version": "6",
"when": 1781885500000,
"tag": "0012_soft_delete",
"breakpoints": true
}
]
}