Alternate names (maiden/married), self-person link, deletion integrity
Names (the genealogy standard: maiden name primary, married/alias as typed
alternates):
- Name model already supported multiple typed names; expose full CRUD —
NameCreate/Read/Update schemas, name_service (one-primary invariant,
promote-on-delete), nested /persons/{id}/names routes.
- Person page gains a Names card: add/edit/delete + "make primary", with a
curated name_type dropdown (birth/maiden, married, alias, nickname, …).
Self-person ("who am I"):
- users.self_person_id FK (use_alter for the users<->persons<->trees cycle)
+ migration; PATCH /users/me/self-person; "This is me" / "This is you"
on the person page. Soft-deleting the linked person clears it.
Deletion integrity (fixes the broken tree view):
- delete_person now soft-deletes the relationships touching the person, so no
dangling edges remain; family-chart also filters links to missing people.
- Optional cascade=true recursively deletes descendants (GEDCOM cleanup);
the person page asks "only this person" vs "with all descendants".
- DELETE returns {deleted: n}.
Family view surfaces "Not connected to anyone" so dangling people aren't lost.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -104,6 +104,11 @@ export default function TreePage() {
|
||||
if (status !== "ready" || mode === "fan" || !containerRef.current) return;
|
||||
let cancelled = false;
|
||||
(async () => {
|
||||
// Only link to people that still exist — a soft-deleted person leaves
|
||||
// dangling relationship rows, and family-chart breaks on an id with no
|
||||
// matching datum. Filter them out so a deletion never blanks the tree.
|
||||
const alive = new Set(people.map((pp) => pp.id));
|
||||
const keep = (ids: string[]) => ids.filter((id) => alive.has(id));
|
||||
const data = people.map((pp) => {
|
||||
const [fn, ln] = splitName(pp.primary_name);
|
||||
return {
|
||||
@@ -114,7 +119,11 @@ export default function TreePage() {
|
||||
birthday: years.get(pp.id) ?? "",
|
||||
gender: pp.gender === "female" ? "F" : "M",
|
||||
},
|
||||
rels: { spouses: partnersOf(pp.id), parents: parentsOf(pp.id), children: childrenOf(pp.id) },
|
||||
rels: {
|
||||
spouses: keep(partnersOf(pp.id)),
|
||||
parents: keep(parentsOf(pp.id)),
|
||||
children: keep(childrenOf(pp.id)),
|
||||
},
|
||||
};
|
||||
});
|
||||
const f3 = await import("family-chart");
|
||||
|
||||
Reference in New Issue
Block a user