@bash-app/bash-common 13.10.0 → 14.0.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": "13.10.0",
3
+ "version": "14.0.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",
@@ -240,6 +240,8 @@ model BashEvent {
240
240
  eventTasks EventTask[]
241
241
  videoLink String?
242
242
  subtitle String?
243
+ isFeatured Boolean?
244
+ isTrending Boolean?
243
245
  }
244
246
 
245
247
  model Checkout {
@@ -831,11 +833,35 @@ model Service {
831
833
  availableDateTimes String[] /// Stored in format: ["startDateTime,endDateTime",...]
832
834
  serviceTargetAudience ServiceTargetAudience[]
833
835
  status ServiceStatus @default(Draft)
836
+ venues Venue[]
834
837
 
835
838
  @@index([email])
836
839
  @@index([phone])
837
840
  }
838
841
 
842
+ model Venue {
843
+ id String @id @default(cuid())
844
+ Service Service? @relation(fields: [serviceId], references: [id])
845
+ serviceId String?
846
+ venueName String
847
+ capacity Int?
848
+ amenities String[]
849
+ additionalInfo String?
850
+ features String[]
851
+ venueTypes String[]
852
+ availableDateTimes Availability[] @relation("AvailableDateTimes")
853
+ // specialDateTimes Availability[] @relation("SpecialDateTimes")
854
+ mission String?
855
+ pitch String?
856
+ communityInvolvement String?
857
+ emergencyContact String?
858
+ contactDetails String?
859
+ rates String?
860
+ cancellationPolicy String?
861
+ refundPolicy String?
862
+ safetyPolicy String?
863
+ }
864
+
839
865
  enum ServiceTag {
840
866
  Italian
841
867
  }
@@ -864,9 +890,12 @@ model ServiceRange {
864
890
  }
865
891
 
866
892
  model Availability {
867
- id String @id @default(cuid())
868
- startDateTime String
869
- endDateTime String
893
+ id String @id @default(cuid())
894
+ startDateTime String
895
+ endDateTime String
896
+ venueId String?
897
+ venueAvailableDateTimes Venue? @relation("AvailableDateTimes", fields: [venueId], references: [id])
898
+ // venueSpecialDateTimes Venue? @relation("SpecialDateTimes", fields: [venueId], references: [id])
870
899
  }
871
900
 
872
901
  enum VisibilityPreference {
@@ -96,11 +96,13 @@ export type FilterFields = {
96
96
  crowd: string[];
97
97
  vibe: string[];
98
98
  included: string[];
99
- hostRating: string[];
100
- specialOffers: string[];
101
- eventFormat: string[];
99
+ hostRating: string[];
100
+ specialOffers: string[];
101
+ eventFormat: string[];
102
102
  };
103
103
 
104
+ export type TicketTierWherePriceIsAString = Omit<TicketTier, 'price'> & {price: string} & {cannotDelete: boolean};
105
+
104
106
  export interface DeletedAndHiddenTiers {
105
107
  deletedTiers: TicketTier[];
106
108
  hiddenTiers: TicketTier[];
@@ -55,11 +55,17 @@ export const BASH_EVENT_DATA_TO_SELECT = {
55
55
  }
56
56
  }
57
57
 
58
+ export const TICKET_TIER_DATA_TO_INCLUDE = {
59
+ promoCodes: true,
60
+ }
61
+
58
62
  export const BASH_EVENT_DATA_TO_INCLUDE = {
59
63
  targetAudience: true,
60
64
  amountOfGuests: true,
61
65
  recurrence: true,
62
- ticketTiers: true,
66
+ ticketTiers: {
67
+ include: TICKET_TIER_DATA_TO_INCLUDE
68
+ },
63
69
  eventTasks: true,
64
70
  media: true,
65
71
  }
@@ -169,7 +175,7 @@ export const ASSOCIATED_BASH_DATA_TO_INCLUDE = {
169
175
  export interface TicketTierExt extends TicketTier {
170
176
  bashEvent: BashEvent;
171
177
  tickets: TicketExt[];
172
- promoCodes?: BashEventPromoCode[];
178
+ promoCodes: BashEventPromoCode[];
173
179
  }
174
180
 
175
181
  export interface TicketExt extends Ticket {
@@ -7,12 +7,8 @@ export function getPromoCodesFromBashEvent(bashEvent: BashEventExt | undefined |
7
7
  return ticketTiersWithPromoCode.map(ticketTier => ticketTier.promoCodes).flat() as BashEventPromoCode[] ?? [];
8
8
  }
9
9
 
10
- export function updatePromoCodesOnBashEventTicketTiers(bashEvent: BashEventExt | undefined | null, promoCodes: BashEventPromoCode[]): void {
11
- bashEvent?.ticketTiers.forEach((tier) => {
12
- tier.promoCodes = [];
13
- const promoCodeWithUpdatedData = promoCodes.find((pc) => tier.id === pc.id);
14
- if (promoCodeWithUpdatedData) {
15
- tier.promoCodes.push(promoCodeWithUpdatedData);
16
- }
10
+ export function updatePromoCodesOnBashEventTicketTiers(bashEvent: BashEventExt, promoCodes: BashEventPromoCode[]): void {
11
+ bashEvent.ticketTiers.forEach((tier) => {
12
+ tier.promoCodes = promoCodes.filter((pc) => tier.id === pc.ticketTierId);
17
13
  });
18
14
  }