- 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>
41 lines
1.2 KiB
TypeScript
41 lines
1.2 KiB
TypeScript
import type { BillingType, GroupAudience, OnboardingGroupDto, WeekDay } from '@gruperly/shared';
|
|
|
|
type PriceLike = { toString(): string };
|
|
|
|
export type OnboardingGroupRecord = {
|
|
id: string;
|
|
name: string;
|
|
description: string | null;
|
|
createdById: string;
|
|
createdAt: Date;
|
|
updatedAt: Date;
|
|
days: WeekDay[] | null;
|
|
time: string | null;
|
|
capacity: number | null;
|
|
price: PriceLike | number | null;
|
|
billingType: BillingType | null;
|
|
dueDay: number | null;
|
|
autoPaymentReminders?: boolean;
|
|
autoReengagement?: boolean;
|
|
audience?: GroupAudience;
|
|
};
|
|
|
|
export function toOnboardingGroupDto(record: OnboardingGroupRecord): OnboardingGroupDto {
|
|
return {
|
|
id: record.id,
|
|
name: record.name,
|
|
description: record.description,
|
|
createdById: record.createdById,
|
|
createdAt: record.createdAt.toISOString(),
|
|
updatedAt: record.updatedAt.toISOString(),
|
|
days: record.days,
|
|
time: record.time,
|
|
capacity: record.capacity,
|
|
price: record.price == null ? null : Number(record.price.toString()),
|
|
billingType: record.billingType,
|
|
dueDay: record.dueDay,
|
|
autoPaymentReminders: record.autoPaymentReminders ?? false,
|
|
autoReengagement: record.autoReengagement ?? false,
|
|
audience: record.audience ?? 'ADULTS',
|
|
};
|
|
} |