Page hierarchy: delete modes (promote/subtree) and trash semantics #107
Labels
No Label
area:auth
area:docs
area:export
area:ops
area:storage
area:supply-chain
auth
backend
blocked
collab
deployment
docs
effort:L
effort:M
effort:S
frontend
plugins
qa
vs-nfd
vs-nfd:blocker
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: stwaidele/dorfteich#107
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
Deleting a page that has children must support two semantics, chosen by the user per case in the UI: promote the children to the deleted page's parent, or trash the whole subtree. Restore must be safe regardless of the order pages are restored in.
Scope
DELETE /pages/:id?mode=promote|subtree(defaultpromote; the mode is irrelevant when the page has no live children) inapps/api/src/pages/pages.controller.ts/pages.service.ts.promote: children'sparentId:= deleted page'sparentId, same transaction as the soft delete.subtree: soft-delete all live descendants with the samedeletedAt/deletedBy. Requires write permission on every live descendant, otherwise 403 (no partial deletes; trash access equals write capability per ADR 0013).parentId.TrashService.restore(apps/api/src/trash/trash.service.ts): re-attach the restored page to its nearest live ancestor, else root (walk the ancestor chain; updateparentIdon restore). This makes restore order-independent.TrashService.purgePage: promote any remaining children (live or trashed) to the purged page's parent before deleting the row (FKSetNullstays as backstop only).Acceptance criteria
Technical notes
deletedAt desc) — no tree rendering in trash.promotedefault so current clients keep working unchanged.Dependencies
Requires #106.
Size
~1 day.
Implemented in
12ff3c0.DELETE /pages/:id?mode=promote|subtree— promote (default) re-attaches live children to the page's parent; subtree trashes all live descendants with one timestamp and requires write on every one of them (403 otherwise, no partial deletes). Trashed pages keepparentId; restore re-attaches to the nearest live ancestor (else root — order-independent, parents never re-claim); purge promotes remaining children.tree-trash.e2e.db.test.tscovers all four acceptance criteria.