All files / src/models invitation.ts

0% Statements 0/0
0% Branches 1/1
0% Functions 1/1
0% Lines 0/0

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103                                                                                                                                                                                                             
/* ── Participant-side invitations (received) ── */
 
export type InvitationStatus = 'PENDING' | 'ACCEPTED' | 'DECLINED' | 'CANCELED' | 'EXPIRED';
 
export interface InvitationEventSummary {
  id: string;
  title: string;
  image_url?: string | null;
  start_time: string;
  end_time?: string | null;
  status: 'ACTIVE' | 'IN_PROGRESS';
  privacy_level: 'PRIVATE';
  approved_participant_count: number;
}
 
export interface InvitationHostSummary {
  id: string;
  username: string;
  display_name?: string | null;
  avatar_url?: string | null;
}
 
export interface ReceivedInvitation {
  invitation_id: string;
  status: InvitationStatus;
  message: string | null;
  expires_at: string | null;
  created_at: string;
  updated_at: string;
  event: InvitationEventSummary;
  host: InvitationHostSummary;
}
 
export interface InvitationPageInfo {
  next_cursor: string | null;
  has_next: boolean;
}
 
export interface ReceivedInvitationsPast {
  items: ReceivedInvitation[];
  page_info: InvitationPageInfo;
}
 
export interface ReceivedInvitationsResponse {
  pending: ReceivedInvitation[];
  past: ReceivedInvitationsPast;
}
 
export interface AcceptInvitationResponse {
  invitation_id: string;
  event_id: string;
  invitation_status: 'ACCEPTED';
  participation_id: string;
  participation_status: 'APPROVED';
  updated_at: string;
}
 
export interface DeclineInvitationResponse {
  invitation_id: string;
  event_id: string;
  status: 'DECLINED';
  updated_at: string;
  cooldown_ends_at: string;
}
 
/* ── Host-side invitation creation ── */
 
export type InvitationFailureCode =
  | 'ALREADY_INVITED'
  | 'ALREADY_PARTICIPATING'
  | 'HOST_USER'
  | 'DECLINE_COOLDOWN_ACTIVE'
  | 'CAPACITY_EXCEEDED'
  | 'DUPLICATE_USERNAME';
 
export interface EventInvitationFailure {
  username: string;
  code: InvitationFailureCode;
}
 
export interface CreatedEventInvitation {
  invitation_id: string;
  event_id: string;
  invited_user_id: string;
  username: string;
  status: 'PENDING';
  created_at: string;
}
 
export interface CreateEventInvitationsRequest {
  usernames: string[];
  message?: string | null;
}
 
export interface CreateEventInvitationsResponse {
  success_count: number;
  invalid_username_count: number;
  failed_count: number;
  successful_invitations: CreatedEventInvitation[];
  invalid_usernames: string[];
  failed: EventInvitationFailure[];
}