@bash-app/bash-common 13.10.0 → 13.11.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": "13.11.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",
@@ -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
  }