feat: add group waitlist functionality

- Introduced GroupWaitlistEntry model in Prisma schema to manage waitlisted users for groups.
- Implemented API route to add users to the group waitlist with validation.
- Enhanced attendee creation logic to handle group capacity and waitlisting scenarios.
- Added new problem builders for handling waitlist-related errors.
- Updated frontend to support waitlist interactions, including modals for capacity warnings.
- Created tests for waitlist functionality, ensuring proper handling of full groups and existing waitlist entries.
This commit is contained in:
Jose Selesan
2026-09-22 16:28:54 -03:00
parent a937c827bb
commit 785d54df7e
16 changed files with 848 additions and 31 deletions

View File

@@ -6,13 +6,17 @@ import type {
ConnectPayment,
ConnectPaymentResult,
CreateAttendee,
CreateAttendeeResult,
CreateFirstGroup,
CreateFirstGroupResult,
CreateGroupWaitlistEntry,
GroupDto,
GroupInviteInfoDto,
GroupList,
GroupWaitlistEntryDto,
InviteTokenResult,
JoinGroupViaInvite,
JoinGroupViaInviteResult,
OnboardingStatusDto,
ProblemDetails,
} from '@gruperly/shared'
@@ -87,13 +91,26 @@ export const getInviteInfo = (token: string) =>
apiFetch<GroupInviteInfoDto>(`/api/v1/invitations/${token}`)
export const joinViaInvite = (token: string, payload: JoinGroupViaInvite) =>
apiFetch<{ attendee: AttendeeDto; message: string }>(`/api/v1/invitations/${token}/join`, {
apiFetch<JoinGroupViaInviteResult>(`/api/v1/invitations/${token}/join`, {
method: 'POST',
body: JSON.stringify(payload),
})
export const createAttendee = (groupId: string, payload: CreateAttendee) =>
apiFetch<AttendeeDto>(`/api/v1/groups/${groupId}/attendees`, {
export const createAttendee = (
groupId: string,
payload: CreateAttendee,
options?: { allowOverflow?: boolean },
) =>
apiFetch<CreateAttendeeResult>(
`/api/v1/groups/${groupId}/attendees${options?.allowOverflow ? '?allowOverflow=true' : ''}`,
{
method: 'POST',
body: JSON.stringify(payload),
},
)
export const addToGroupWaitlist = (groupId: string, payload: CreateGroupWaitlistEntry) =>
apiFetch<GroupWaitlistEntryDto>(`/api/v1/groups/${groupId}/waitlist`, {
method: 'POST',
body: JSON.stringify(payload),
})