feat(groups): kids groups with an adult in charge

- Add the `kidsGroups` plan feature (Pro) and `Group.audience` (ADULTS | KIDS);
  creating or switching a group to KIDS requires the feature, existing KIDS
  groups keep working after a downgrade.
- Model the adult in charge as a Person linked through `person_guardians`;
  migrate the old guardian_name/guardian_phone columns and drop them.
- Kids quick add: kid + guardian form, guardian lookup by phone to pick an
  existing kid or add a sibling; backend rejects KIDS adds without guardian.
- Attendee page: "Adulto a cargo" section with siblings, editable via
  PATCH /groups/:gid/attendees/:aid/guardian.
- Contact phone (WhatsApp jobs, attention, student access invite, students at
  risk, attendee actions) prefers the guardian's phone.
- Edit group screen (PATCH /groups/:gid, owner only); switching back to ADULTS
  is blocked while kids have no phone of their own.
- Hide bulk import in KIDS groups until it carries guardian data.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Jose Selesan
2026-11-11 13:27:13 -03:00
parent aac142d324
commit 58c776e18c
89 changed files with 1805 additions and 110 deletions

View File

@@ -24,9 +24,12 @@ const personSelect = {
fullName: true,
email: true,
phone: true,
guardianName: true,
guardianPhone: true,
notes: true,
guardians: {
take: 1,
orderBy: { createdAt: 'asc' },
select: { guardian: { select: { id: true, fullName: true, phone: true, email: true } } },
},
};
const person = {
@@ -34,9 +37,8 @@ const person = {
fullName: 'Ana Pérez',
email: 'ana@example.com',
phone: null,
guardianName: 'Luis Pérez',
guardianPhone: null,
notes: null,
guardians: [{ guardian: { id: 'person-9', fullName: 'Luis Pérez', phone: '1199990000', email: null } }],
};
const attendeeRow = {
@@ -75,8 +77,10 @@ describe('attendees routes', () => {
fullName: person.fullName,
email: person.email,
phone: person.phone,
guardianName: person.guardianName,
guardianPhone: person.guardianPhone,
guardianPersonId: 'person-9',
guardianName: 'Luis Pérez',
guardianPhone: '1199990000',
guardianEmail: null,
notes: person.notes,
createdAt: attendeeRow.createdAt.toISOString(),
updatedAt: attendeeRow.updatedAt.toISOString(),