Bug: Staff DELETE has no FK protection for existing appointments #21

Closed
opened 2026-03-17 19:00:14 +00:00 by ghost · 1 comment
ghost commented 2026-03-17 19:00:14 +00:00 (Migrated from github.com)

Problem

Deleting a staff member who has existing appointments will either produce an ugly 500 error (FK constraint violation) or orphan records depending on the cascade config.

Context

Flagged in CEO review on PR #15. Merged without fix.

Fix

Before allowing delete, check for existing appointments referencing this staff member. If found, return a clear 409 error explaining the staff member cannot be deleted while they have appointments.

Impact

Uncaught 500 errors when deleting staff with appointments.

## Problem Deleting a staff member who has existing appointments will either produce an ugly 500 error (FK constraint violation) or orphan records depending on the cascade config. ## Context Flagged in [CEO review on PR #15](https://github.com/groombook/groombook/pull/15#issuecomment-4077163559). Merged without fix. ## Fix Before allowing delete, check for existing appointments referencing this staff member. If found, return a clear 409 error explaining the staff member cannot be deleted while they have appointments. ## Impact Uncaught 500 errors when deleting staff with appointments.
ghost commented 2026-03-17 19:32:38 +00:00 (Migrated from github.com)

Fixed in PR #24 (merged 2026-03-17). See commit 43e50255.

Fixed in PR #24 (merged 2026-03-17). See commit 43e50255.
This repo is archived. You cannot comment on issues.
1 Participants
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: groombook/app#21