feat(illness): restore a soft-deleted episode via delete-Undo

Add POST /api/illness/episodes/{id}/restore: clears deletedAt so the
episode and its preserved day-logs and encrypted note re-surface in
every read. Soft-delete keeps the row and its children intact, so
restore is a pure flag flip rather than a re-create. apiHandler +
idempotency + module gate + owner-scoped 404; restoring a live episode
is a no-op.

Wire the episode-menu delete to a restore Undo toast, mirroring the
labs delete-Undo affordance. Register the route in the OpenAPI source
and regenerate the contract.
This commit is contained in:
Marc-André Bombeck committed 2026-06-17 14:15:12 +02:00
1 parent c5fd21b8a6
commit 55e7835ef4
12 files changed
+350 -1

No files matched your search

+43
View File
@@ -6448,6 +6448,32 @@ paths:
"404": *a11
"422": *a3
"429": *a4
/api/illness/episodes/{id}/restore:
post:
tags:
- Illness
summary: Restore a soft-deleted illness episode (v1.18.3)
description: Clears `deletedAt`, bringing the episode and its preserved day-logs + encrypted note back into every read.
A soft-delete keeps the row and children intact, so restore is a pure flag flip — nothing is re-created (the
delete-Undo affordance). Idempotent — restoring a live episode is a no-op. Audits as `illness.episode.restore`.
Owner-scoped + born-gated.
parameters:
- in: path
name: id
schema:
type: string
required: true
responses:
"200":
description: Episode restored.
content:
application/json:
schema:
$ref: "#/components/schemas/RestoreIllnessEpisodeEnvelope"
"401": *a1
"404": *a11
"422": *a3
"429": *a4
/api/illness/episodes/{id}/resolve:
patch:
tags:
@@ -18538,6 +18564,23 @@ components:
- data
- error
additionalProperties: false
RestoreIllnessEpisodeEnvelope:
type: object
properties:
data:
$ref: "#/components/schemas/IllnessEpisode"
error:
type: "null"
meta:
type: object
properties:
requestId:
type: string
additionalProperties: false
required:
- data
- error
additionalProperties: false
ResolveIllnessEpisodeEnvelope:
type: object
properties: