feat(student-portal): student account belongs to the adult in charge

- Inviting a kid with an adult in charge links the account to the adult
  (a legacy account linked to the kid moves to the adult and is renamed).
- `linkedPersonWhere` lets the account reach the kids of a linked adult, so
  the adult sees and manages all their kids, including ones added later.
- /me, link info and access status follow the adult; siblings share state.
- Web: greeting uses the account holder, profile lists each kid's group, and
  the invitation sheet/message address the adult.
- DB tests for the adult account flow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Jose Selesan
2026-11-11 14:04:25 -03:00
parent 9383841513
commit 5b3a035dcf
17 changed files with 336 additions and 66 deletions

View File

@@ -13,6 +13,7 @@ import { occurrencesBetween } from '@/modules/home/lib/scheduler';
import {
classAlreadyStartedProblem,
findLinkedAttendee,
linkedPersonWhere,
studentAttendeeNotFoundProblem,
teacherTimeZone,
} from '../../lib';
@@ -127,7 +128,7 @@ export class CancelStudentAbsence {
where: {
id: noticeId,
cancelledAt: null,
attendee: { status: { not: 'DROPPED' }, person: { studentAccounts: { some: { accountId } } } },
attendee: { status: { not: 'DROPPED' }, person: linkedPersonWhere(accountId) },
},
select: { id: true, attendeeId: true, classSessionId: true, classSession: { select: { startsAt: true } } },
});