Let a department sit under a parent department

Featurekamo-shared-library
Shipped
August 7, 2026 at 5:45 AM UTC
Author
Kamo
Commit
86dee33

Departments were a flat list, so an org chart with Operations > Customer Success > Onboarding had no way to say so. Department gains an optional self-referencing parent; null still means top level, which is what every existing row stays. The FK column pins columnDefinition = "UUID". Left off, Hibernate copies the referenced primary key's definition -- UUID DEFAULT gen_random_uuid() -- onto the FK, so a ddl-auto run over a populated DEPTS stamps every row with a random parent matching no department and the ADD CONSTRAINT that follows fails. Parent assignment is validated in the service, not just the picker: self-parent, cycles (walking up from the proposed parent must not reach the department being moved), a parent in another organization, and an unknown id are all refused. Deleting a department promotes its children to its own parent rather than stranding them behind a dangling pointer. **************** now take their request DTO instead of eight positional arguments, which is what made adding a ninth worth avoiding.

All changes

Like what you see shipping?

Every one of these updates lands in your workspace automatically. Start free and watch it grow week after week.

Start Free ForeverView Pricing