feat(#158): affiliation enfant au foyer — attach/detach pivot + co-parent.
Squash depuis develop : un POST/DELETE propage les liens à tout le foyer ; front un seul appel API ; doc empreinte. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1277,18 +1277,16 @@ class _AdminChildDetailModalState extends State<AdminChildDetailModal> {
|
||||
return;
|
||||
}
|
||||
|
||||
// Édition orphelin (#157) : rattache immédiatement au foyer.
|
||||
// Édition orphelin (#157/#158) : un seul attach — le back propage au foyer.
|
||||
final enfantId = widget.enfant?.id;
|
||||
if (enfantId == null || enfantId.isEmpty) return;
|
||||
|
||||
setState(() => _saving = true);
|
||||
try {
|
||||
for (final parentId in selected.parentUserIds) {
|
||||
await UserService.attachEnfantToParent(
|
||||
parentUserId: parentId,
|
||||
enfantId: enfantId,
|
||||
);
|
||||
}
|
||||
await UserService.attachEnfantToParent(
|
||||
parentUserId: selected.pivotParentUserId,
|
||||
enfantId: enfantId,
|
||||
);
|
||||
final refreshed = await UserService.getEnfant(enfantId);
|
||||
if (!mounted) return;
|
||||
setState(() {
|
||||
|
||||
Reference in New Issue
Block a user