@bash-app/bash-common 29.51.0 → 29.53.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bash-app/bash-common",
3
- "version": "29.51.0",
3
+ "version": "29.53.0",
4
4
  "description": "Common data and scripts to use on the frontend and backend",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -917,6 +917,10 @@ model User {
917
917
  volunteerService VolunteerService[]
918
918
  stripeAccounts StripeAccount[]
919
919
  userPromoCodeRedemption UserPromoCodeRedemption[]
920
+ accepted Boolean? @default(false) // Tracks if the user accepted the invitation
921
+ boughtTicket Boolean? @default(false) // Tracks if the user bought a ticket
922
+ noPay Boolean? @default(false) // Tracks if the user is marked as "noPay"
923
+ supportedEvent Boolean? @default(false) // Tracks if the user supported the event
920
924
 
921
925
  // primaryStripeAccountDBId String? @unique
922
926
  // primaryStripeAccountDB StripeAccount? @relation("PrimaryStripeAccount", fields: [primaryStripeAccountDBId], references: [id], onDelete: Restrict, onUpdate: Restrict)
@@ -627,17 +627,32 @@ export type AllKeysUnionOfDescendants<T> = T extends object
627
627
 
628
628
  export type AllKeysOfDescendants<T> = AllKeysUnionOfDescendants<T>[];
629
629
 
630
- type AllKeysUnion<T> = T extends object
630
+ type Decrement<N extends number> = N extends 5
631
+ ? 4
632
+ : N extends 4
633
+ ? 3
634
+ : N extends 3
635
+ ? 2
636
+ : N extends 2
637
+ ? 1
638
+ : N extends 1
639
+ ? 0
640
+ : never;
641
+
642
+ type AllKeysUnion<T, Depth extends number = 5> = Depth extends 0
643
+ ? never
644
+ : T extends object
631
645
  ? T[keyof T] extends infer K
632
646
  ? K extends string | number | symbol
633
647
  ? {
634
648
  [K in keyof T]-?: T[K] extends any[]
635
- ? GetTypeOfArray<T[K]> extends Record<RecordKey, any>
649
+ ? GetTypeOfArray<T[K]> extends Record<string, any>
636
650
  ?
637
651
  | `${K & string}`
638
652
  | `${K &
639
653
  string}${typeof URL_INCLUDE_PRISMA_DATA_KEYS_DELIM}${AllKeysUnion<
640
- GetTypeOfArray<T[K]>
654
+ GetTypeOfArray<T[K]>,
655
+ Decrement<Depth>
641
656
  > &
642
657
  string}`
643
658
  : never
@@ -647,7 +662,8 @@ type AllKeysUnion<T> = T extends object
647
662
  | `${K & string}`
648
663
  | `${K &
649
664
  string}${typeof URL_INCLUDE_PRISMA_DATA_KEYS_DELIM}${AllKeysUnion<
650
- T[K]
665
+ T[K],
666
+ Decrement<Depth>
651
667
  > &
652
668
  string}`;
653
669
  }[keyof T]
@@ -657,6 +673,7 @@ type AllKeysUnion<T> = T extends object
657
673
 
658
674
  export type AllKeys<T> = AllKeysUnion<T>[];
659
675
 
676
+
660
677
  export interface IAddress {
661
678
  place?: string;
662
679
  googlePlaceId?: string;
@@ -102,6 +102,10 @@ export const FRONT_END_USER_DATA_TO_SELECT = {
102
102
  reviews: true,
103
103
  userRating: true,
104
104
  contacts: true,
105
+ accepted: true, // Newly added field
106
+ boughtTicket: true, // Newly added field
107
+ noPay: true, // Newly added field
108
+ supportedEvent: true, // Newly added field
105
109
  } satisfies Prisma.UserSelect;
106
110
 
107
111
  export const PRIVATE_USER_ACCOUNT_TO_SELECT = {
@@ -124,10 +128,10 @@ export interface BashEventExt extends BashEvent {
124
128
  creator?: PublicUser;
125
129
  ticketTiers: TicketTierExt[];
126
130
  media: Media[];
127
- eventTasks?: EventTask[];
131
+ eventTasks: EventTask[];
128
132
  tickets?: Ticket[]; // Only include tickets that the user has purchased and not all tickets (could be thousands + privacy)
129
133
  // Do not include in fetch. Could be hundreds of these
130
- invitations?: InvitationExt[];
134
+ invitations: Partial<InvitationExt>[];
131
135
  coordinates?: Coordinates[];
132
136
  }
133
137
 
@@ -155,7 +159,6 @@ export const TICKET_TIER_DATA_TO_INCLUDE = {
155
159
  promoCodes: true,
156
160
  } satisfies Prisma.TicketTierInclude;
157
161
 
158
-
159
162
  export const BASH_EVENT_DATA_TO_INCLUDE = {
160
163
  creator: {
161
164
  select: FRONT_END_USER_DATA_TO_SELECT,
@@ -163,68 +166,12 @@ export const BASH_EVENT_DATA_TO_INCLUDE = {
163
166
  targetAudience: true,
164
167
  amountOfGuests: true,
165
168
  recurrence: true,
166
- ticketTiers: {
167
- include: {
168
- promoCodes: true,
169
- bashEvent: true,
170
- tickets: {
171
- include: {
172
- owner: {
173
- select: {
174
- id: true,
175
- email: true,
176
- givenName: true,
177
- familyName: true,
178
- image: true,
179
- createdOn: true,
180
- isSuperUser: true,
181
- uploadedImage: true,
182
- dob: true,
183
- gender: true,
184
- sex: true,
185
- city: true,
186
- state: true,
187
- documentIDId: true,
188
- reviews: true,
189
- userRating: true,
190
- socialMediaProfiles: true,
191
- contacts: true,
192
- },
193
- },
194
- forUser: {
195
- select: {
196
- id: true,
197
- email: true,
198
- givenName: true,
199
- familyName: true,
200
- image: true,
201
- createdOn: true,
202
- isSuperUser: true,
203
- uploadedImage: true,
204
- dob: true,
205
- gender: true,
206
- sex: true,
207
- city: true,
208
- state: true,
209
- documentIDId: true,
210
- reviews: true,
211
- userRating: true,
212
- socialMediaProfiles: true,
213
- contacts: true,
214
- },
215
- },
216
- },
217
- },
218
- },
219
- },
169
+ ticketTiers: true,
220
170
  media: true,
221
- eventTasks: true,
171
+ eventTasks: true,
172
+ invitations: true,
222
173
  } satisfies Prisma.BashEventInclude;
223
174
 
224
-
225
-
226
-
227
-
228
175
  export const BASH_EVENT_DATA_TO_CLONE = [
229
176
  "ticketTiers",
230
177
  "media",
@@ -561,10 +508,10 @@ export const EVENT_TASK_DATA_TO_INCLUDE = {
561
508
  } satisfies Prisma.EventTaskInclude;
562
509
 
563
510
  export interface InvitationExt extends Invitation {
564
- creator: PublicUser;
565
- sentTo: PublicUser;
566
- tickets: Ticket[];
567
- associatedBash?: AssociatedBash | null;
511
+ creator: PublicUser; // Include full details of the creator
512
+ sentTo?: PublicUser; // Full details of the user the invitation was sent to
513
+ associatedBash?: Partial<AssociatedBashExt> | null
514
+ tickets: Ticket[]; // Tickets associated with the invitation
568
515
  }
569
516
 
570
517
  export const INVITATION_DATA_TO_INCLUDE = {
@@ -583,8 +530,8 @@ export interface InvitationExtraData extends Invitation {
583
530
  }
584
531
 
585
532
  export interface AssociatedBashExt extends AssociatedBash {
586
- bashEvent: BashEventExt;
587
- invitation: InvitationExt;
533
+ bashEvent: Partial<BashEventExt>;
534
+ invitation?: Partial<InvitationExt>;
588
535
  }
589
536
 
590
537
  export interface AssociatedServiceExt extends AssociatedService {
@@ -664,18 +611,20 @@ export interface UserExt extends User {
664
611
  createdServices?: ServiceExt[];
665
612
  password?: string;
666
613
  otp?: string;
667
- userRating?: UserRating[];}
614
+ userRating?: UserRating[];
615
+ }
668
616
 
669
617
  export const USER_DATA_SELECT_REVIEWS_COMMENTS = {
670
618
  reviews: {
671
619
  select: {
672
620
  id: true,
673
621
  rating: true,
674
- creatorId: true, // Fetches the creatorId from Review
675
- bashEventId: true, // Fetches the bashEventId
622
+ creatorId: true, // Fetches the creatorId from Review
623
+ bashEventId: true, // Fetches the bashEventId
676
624
  createdAt: true,
677
625
  updatedAt: true,
678
- comments: { // This matches the relation field in the schema
626
+ comments: {
627
+ // This matches the relation field in the schema
679
628
  select: {
680
629
  id: true,
681
630
  content: true,
@@ -685,7 +634,6 @@ export const USER_DATA_SELECT_REVIEWS_COMMENTS = {
685
634
  },
686
635
  } satisfies Prisma.UserSelect;
687
636
 
688
-
689
637
  export type PublicUser = Pick<
690
638
  UserExt,
691
639
  keyof typeof FRONT_END_USER_DATA_TO_SELECT