@bash-app/bash-common 1.13.0 → 1.14.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": "1.13.0",
3
+ "version": "1.14.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",
@@ -19,9 +19,7 @@
19
19
  "dependencies": {
20
20
  "@aws-sdk/client-s3": "^3.590.0",
21
21
  "@aws-sdk/client-textract": "^3.590.0",
22
- "@aws-sdk/s3-request-presigner": "^3.590.0",
23
- "ts-node": "^10.9.1",
24
- "typescript": "^5.2.2"
22
+ "@aws-sdk/s3-request-presigner": "^3.590.0"
25
23
  },
26
24
  "peerDependencies": {
27
25
  "dayjs": "^1.11.10",
@@ -38,6 +36,8 @@
38
36
  "prisma": "^5.13.0",
39
37
  "shelljs": "^0.8.5",
40
38
  "ts-jest": "^29.1.1",
41
- "tslib": "^2.6.2"
39
+ "tslib": "^2.6.2",
40
+ "ts-node": "^10.9.1",
41
+ "typescript": "^5.2.2"
42
42
  }
43
43
  }
@@ -152,6 +152,21 @@ model Reminder {
152
152
  notification BashNotification @relation(fields: [notificationId], references: [id], onDelete: Cascade)
153
153
  }
154
154
 
155
+ model BashEventPromoCode {
156
+ id String @id @default(cuid())
157
+ bashEventId String
158
+ bashEvent BashEvent @relation(fields: [bashEventId], references: [id], onDelete: Cascade)
159
+ code String
160
+ currency String @default("USD")
161
+ discountAmountInCents Int?
162
+ discountAmountPercentage Float?
163
+ usedBy User[]
164
+ validStartDateTime DateTime @default(now())
165
+ validUntilDateTime DateTime?
166
+
167
+ @@unique([bashEventId, code])
168
+ }
169
+
155
170
  model BashNotification {
156
171
  id String @id @default(cuid())
157
172
  creatorId String
@@ -198,14 +213,14 @@ model Invitation {
198
213
  }
199
214
 
200
215
  model BashEvent {
201
- id String @id @default(cuid())
216
+ id String @id @default(cuid())
202
217
  title String
203
218
  creatorId String
204
- creator User @relation("CreatedEvent", fields: [creatorId], references: [id], onDelete: Cascade)
219
+ creator User @relation("CreatedEvent", fields: [creatorId], references: [id], onDelete: Cascade)
205
220
  description String?
206
- eventType String @default("Other")
207
- startDateTime DateTime? @default(now())
208
- endDateTime DateTime? @default(now())
221
+ eventType String @default("Other")
222
+ startDateTime DateTime? @default(now())
223
+ endDateTime DateTime? @default(now())
209
224
  ticketTiers TicketTier[]
210
225
  targetAudience TargetAudience?
211
226
  amountOfGuests AmountOfGuests?
@@ -217,18 +232,18 @@ model BashEvent {
217
232
  notAllowed String?
218
233
  nonProfit Boolean?
219
234
  nonProfitId String?
220
- privacy Privacy @default(Public)
235
+ privacy Privacy @default(Public)
221
236
  tickets Ticket[]
222
237
  reviews Review[]
223
238
  sponsorships SponsoredEvent[]
224
239
  investments Investment[]
225
240
  capacity Int?
226
241
  location String?
227
- status BashStatus @default(Draft)
242
+ status BashStatus @default(Draft)
228
243
  tags String[]
229
244
  coverPhoto String?
230
245
  media Media[]
231
- club Club? @relation(fields: [clubId], references: [id], onDelete: SetNull)
246
+ club Club? @relation(fields: [clubId], references: [id], onDelete: SetNull)
232
247
  clubId String?
233
248
  links EventLink[]
234
249
  competitions Competition[]
@@ -242,6 +257,7 @@ model BashEvent {
242
257
  eventTasks EventTask[]
243
258
  videoLink String?
244
259
  subtitle String?
260
+ promoCodes BashEventPromoCode[]
245
261
  }
246
262
 
247
263
  model Checkout {
@@ -744,6 +760,7 @@ model User {
744
760
  ticketTiersWaitListsIveJoined TicketTier[]
745
761
  contacts Contact[]
746
762
  contactsReferencingMe Contact[] @relation("ContactsReferencingMe")
763
+ bashEventPromoCodesIUsed BashEventPromoCode[]
747
764
  }
748
765
 
749
766
  model Contact {
@@ -8,12 +8,10 @@ import {
8
8
  Ticket,
9
9
  User,
10
10
  TicketTier, Service, Review, Media, BashComment, Recurrence, Contact,
11
- BashNotification
11
+ BashNotification, BashEventPromoCode,
12
+ Reminder
12
13
  } from "@prisma/client";
13
- import {RecordKey} from "./definitions";
14
14
 
15
- // TODO: Get this to work
16
- type PrismaInclude<T extends Record<RecordKey, unknown>> = {[key in keyof T]: boolean | {include: T[key]}};
17
15
 
18
16
  export interface BashEventExt extends BashEvent {
19
17
  targetAudience?: TargetAudience;
@@ -23,34 +21,18 @@ export interface BashEventExt extends BashEvent {
23
21
  ticketTiers: TicketTierExt[];
24
22
  media: Media[];
25
23
  eventTasks: EventTask[];
24
+ promoCodes?: BashEventPromoCode[];
26
25
  tickets?: Ticket[]; // Only include tickets that the user has purchased and not all tickets (could be thousands + privacy)
27
26
  // Do not include in fetch. Could be hundreds of these
28
27
  invitations: InvitationExt[];
29
28
  }
30
29
 
31
30
  export interface BashNotificationsExt extends BashNotification {
32
- creator?: {
33
- id: string;
34
- name: string;
35
- image?: string;
36
- };
37
- bashEvent?: {
38
- id: string;
39
- name: string;
40
- coverPhoto?: string;
41
- };
42
- eventTask?: {
43
- id: string;
44
- title: string;
45
- };
46
- invitation?: {
47
- id: string;
48
- eventName: string;
49
- };
50
- reminders?: Array<{
51
- id: string;
52
- reminderText: string;
53
- }>;
31
+ creator?: User;
32
+ bashEvent?: BashEvent;
33
+ eventTask?: EventTask;
34
+ invitation?: Invitation;
35
+ reminders?: Reminder[];
54
36
  }
55
37
 
56
38
  export const BASH_EVENT_DATA_TO_INCLUDE = {
@@ -60,7 +42,8 @@ export const BASH_EVENT_DATA_TO_INCLUDE = {
60
42
  ticketTiers: true,
61
43
  creator: true,
62
44
  eventTasks: true,
63
- media: true
45
+ media: true,
46
+ promoCodes: true,
64
47
  }
65
48
 
66
49
  export const BASH_EVENT_DATA_TO_CLONE = [
@@ -70,6 +53,7 @@ export const BASH_EVENT_DATA_TO_CLONE = [
70
53
  'media',
71
54
  'recurrence',
72
55
  'invitations',
56
+ 'promoCodes',
73
57
  ] as const;
74
58
 
75
59
  type RemoveCommonProperties<T, U> = keyof (Omit<T, keyof U> & Omit<U, keyof T>);