@bash-app/bash-common 30.50.0 → 30.51.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/README.md CHANGED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bash-app/bash-common",
3
- "version": "30.50.0",
3
+ "version": "30.51.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",
@@ -195,40 +195,78 @@ model PromoterClick {
195
195
  clickedAt DateTime @default(now())
196
196
  }
197
197
 
198
+ enum NotificationType {
199
+ General
200
+ Follow
201
+ TaskAssigned
202
+ TaskUnassigned
203
+ TaskRequest
204
+ TaskCompleted
205
+ BashApprovalRequest
206
+ BashApproved
207
+ BashRejected
208
+ BashTrending
209
+ BashOrganizerNewBash
210
+ BashCheckIn
211
+ BashAutoCheckIn
212
+ Invitation
213
+ ServiceBookingRequest
214
+ ServiceBookingApproved
215
+ ServiceBookingDeclined
216
+ ServiceBookingCancelled
217
+ ServiceBookingConfirmed
218
+ }
219
+
220
+ enum NotificationPriority {
221
+ High
222
+ Medium
223
+ Low
224
+ }
225
+
226
+ enum NotificationActionType {
227
+ Accept
228
+ Approve
229
+ Reject
230
+ View
231
+ Complete
232
+ Cancel
233
+ Other
234
+ }
235
+
198
236
  model Notification {
199
- id String @id @default(cuid())
237
+ id String @id @default(cuid())
200
238
  creatorId String
201
- creator User @relation("NotificationsCreatedByMe", fields: [creatorId], references: [id], onDelete: Cascade)
239
+ creator User @relation("NotificationsCreatedByMe", fields: [creatorId], references: [id], onDelete: Cascade)
202
240
  email String
203
241
  userId String? // Direct reference to recipient user
204
- user User? @relation("NotificationsReceivedByMe", fields: [userId], references: [id], onDelete: Cascade)
205
- createdDateTime DateTime @default(now())
242
+ user User? @relation("NotificationsReceivedByMe", fields: [userId], references: [id], onDelete: Cascade)
243
+ createdDateTime DateTime @default(now())
206
244
  message String
207
245
  image String?
208
246
  readDateTime DateTime?
209
- type String // Notification type: "FOLLOW", "TASK", "EVENT", etc.
247
+ type NotificationType // Notification type: "FOLLOW", "TASK", "EVENT", etc.
210
248
  taskId String?
211
- eventTask EventTask? @relation(fields: [taskId], references: [id], onDelete: Cascade)
249
+ eventTask EventTask? @relation(fields: [taskId], references: [id], onDelete: Cascade)
212
250
  invitationId String?
213
- invitation Invitation? @relation(fields: [invitationId], references: [id], onDelete: Cascade)
251
+ invitation Invitation? @relation(fields: [invitationId], references: [id], onDelete: Cascade)
214
252
  bashEventId String?
215
- bashEvent BashEvent? @relation(fields: [bashEventId], references: [id], onDelete: Cascade)
253
+ bashEvent BashEvent? @relation(fields: [bashEventId], references: [id], onDelete: Cascade)
216
254
  serviceId String?
217
- service Service? @relation(fields: [serviceId], references: [id], onDelete: Cascade)
255
+ service Service? @relation(fields: [serviceId], references: [id], onDelete: Cascade)
218
256
  serviceBookingId String?
219
- serviceBooking ServiceBooking? @relation(fields: [serviceBookingId], references: [id], onDelete: Cascade)
257
+ serviceBooking ServiceBooking? @relation(fields: [serviceBookingId], references: [id], onDelete: Cascade)
220
258
  reminders Reminder[]
221
259
  redirectUrl String?
222
260
 
223
261
  // Additional specific fields for different notification types
224
262
  actionTaken Boolean? // For notifications that may require action
225
- actionType String? // Type of action taken (ACCEPT, REJECT, etc.)
226
- priority String? // Priority level (HIGH, MEDIUM, LOW)
263
+ actionType NotificationActionType?
264
+ priority NotificationPriority?
227
265
  expiresAt DateTime? // For time-sensitive notifications
228
266
 
229
- @@unique([creatorId, email, bashEventId, taskId])
230
- @@unique([creatorId, email, invitationId])
231
- @@unique([creatorId, email, serviceBookingId])
267
+ // @@unique([creatorId, email, bashEventId, taskId, type])
268
+ @@unique([creatorId, email, invitationId, type])
269
+ @@unique([creatorId, email, serviceBookingId, type])
232
270
  @@index([creatorId])
233
271
  @@index([userId])
234
272
  @@index([type]) // Add index for efficient filtering by notification type
@@ -1137,18 +1175,18 @@ model UserPreferences {
1137
1175
  user User @relation(fields: [userId], references: [id], onDelete: Cascade)
1138
1176
 
1139
1177
  // Notification Preferences
1140
- emailNotifications Boolean @default(true)
1178
+ emailNotifications Boolean @default(true)
1141
1179
  pushNotifications Boolean @default(true)
1142
- marketingEmails Boolean @default(true) // Added from our UI
1143
- eventUpdates Boolean @default(true) // Added from our UI
1144
- serviceBookingNotifications Boolean @default(true) // Added from our UI
1145
- reviewReminders Boolean @default(true) // Added from our UI
1146
- newFollowerNotifications Boolean @default(true) // Added from our UI
1147
- trendingBashesNotify Boolean @default(true) // Updated default to true
1148
- organizerUpdatesNotify Boolean @default(true) // Updated default to true
1149
- recurringReminders Boolean @default(true) // NEW - multiple reminders as event approaches
1150
- eventSuggestions Boolean @default(true) // NEW - event planning tips and suggestions
1151
- serviceSuggestions Boolean @default(true) // NEW - vendor/service recommendations
1180
+ marketingEmails Boolean @default(true) // Added from our UI
1181
+ eventUpdates Boolean @default(true) // Added from our UI
1182
+ serviceBookingNotifications Boolean @default(true) // Added from our UI
1183
+ reviewReminders Boolean @default(true) // Added from our UI
1184
+ newFollowerNotifications Boolean @default(true) // Added from our UI
1185
+ trendingBashesNotify Boolean @default(true) // Updated default to true
1186
+ organizerUpdatesNotify Boolean @default(true) // Updated default to true
1187
+ recurringReminders Boolean @default(true) // NEW - multiple reminders as event approaches
1188
+ eventSuggestions Boolean @default(true) // NEW - event planning tips and suggestions
1189
+ serviceSuggestions Boolean @default(true) // NEW - vendor/service recommendations
1152
1190
  eventReminderNotify Boolean @default(true)
1153
1191
  newMessageNotify Boolean @default(true)
1154
1192
  invitationNotify Boolean @default(true)
@@ -1156,35 +1194,35 @@ model UserPreferences {
1156
1194
  servicePromotionsNotify Boolean @default(true)
1157
1195
 
1158
1196
  // Privacy Settings
1159
- profileVisibility String @default("public") // Updated to lowercase, matches our UI
1160
- eventHistoryVisibility Boolean @default(true) // Added from our UI
1161
- servicesVisibility Boolean @default(true) // Added from our UI
1162
- searchVisibility Boolean @default(true) // Added from our UI
1163
- hideFollowLists Boolean @default(false) // NEW - hide follower/following lists
1164
- attendancePrivacy String @default("public") // Updated to lowercase, matches our UI
1165
- hideEventPrices Boolean @default(false) // NEW - hide prices until day of event
1166
- showOnlineStatus Boolean @default(true)
1167
- allowDirectMessages Boolean @default(true)
1168
- blockSearchEngineIndex Boolean @default(false)
1197
+ profileVisibility String @default("public") // Updated to lowercase, matches our UI
1198
+ eventHistoryVisibility Boolean @default(true) // Added from our UI
1199
+ servicesVisibility Boolean @default(true) // Added from our UI
1200
+ searchVisibility Boolean @default(true) // Added from our UI
1201
+ hideFollowLists Boolean @default(false) // NEW - hide follower/following lists
1202
+ attendancePrivacy String @default("public") // Updated to lowercase, matches our UI
1203
+ hideEventPrices Boolean @default(false) // NEW - hide prices until day of event
1204
+ showOnlineStatus Boolean @default(true)
1205
+ allowDirectMessages Boolean @default(true)
1206
+ blockSearchEngineIndex Boolean @default(false)
1169
1207
 
1170
1208
  // Contact Management (NEW SECTION)
1171
- autoAddEventAttendees Boolean @default(true) // NEW - auto-add event attendees to contacts
1172
- trackFirstEventAttended Boolean @default(true) // NEW - remember which bash connected you
1173
- autoAddServiceClients Boolean @default(true) // NEW - auto-add service clients to contacts
1209
+ autoAddEventAttendees Boolean @default(true) // NEW - auto-add event attendees to contacts
1210
+ trackFirstEventAttended Boolean @default(true) // NEW - remember which bash connected you
1211
+ autoAddServiceClients Boolean @default(true) // NEW - auto-add service clients to contacts
1174
1212
 
1175
1213
  // UI/UX Preferences
1176
- theme String @default("system") // Updated to lowercase, matches our UI
1177
- language String @default("en") // Simplified from en-US
1178
- timeZone String @default("America/New_York")
1214
+ theme String @default("system") // Updated to lowercase, matches our UI
1215
+ language String @default("en") // Simplified from en-US
1216
+ timeZone String @default("America/New_York")
1179
1217
 
1180
1218
  // Event Preferences
1181
- eventReminderTiming String @default("1day") // NEW - 1hour, 1day, 1week (replaces defaultEventReminder)
1182
- locationRadius Int @default(50) // NEW - miles for event suggestions
1183
- calendarStartDay Int @default(0) // 0=Sunday, 1=Monday
1184
- defaultCalendarView String @default("MONTH") // DAY, WEEK, MONTH, AGENDA
1219
+ eventReminderTiming String @default("1day") // NEW - 1hour, 1day, 1week (replaces defaultEventReminder)
1220
+ locationRadius Int @default(50) // NEW - miles for event suggestions
1221
+ calendarStartDay Int @default(0) // 0=Sunday, 1=Monday
1222
+ defaultCalendarView String @default("MONTH") // DAY, WEEK, MONTH, AGENDA
1185
1223
 
1186
1224
  // Security & Consent Preferences
1187
- biometricAuthEnabled Boolean @default(false) // NEW - Face ID/Touch ID/Fingerprint
1225
+ biometricAuthEnabled Boolean @default(false) // NEW - Face ID/Touch ID/Fingerprint
1188
1226
  dataUsageConsent Boolean @default(true)
1189
1227
  analyticsConsent Boolean @default(true)
1190
1228
 
@@ -1197,28 +1235,28 @@ model UserPreferences {
1197
1235
  updatedAt DateTime @updatedAt
1198
1236
 
1199
1237
  // Less Relevant Fields (moved to bottom)
1200
- smsNotifications Boolean @default(false) // We're not using SMS
1201
- friendRequestNotify Boolean @default(true) // We use followers, not friends
1202
- allowTagging Boolean @default(true)
1203
- showActivityStatus Boolean @default(true)
1238
+ smsNotifications Boolean @default(false) // We're not using SMS
1239
+ friendRequestNotify Boolean @default(true) // We use followers, not friends
1240
+ allowTagging Boolean @default(true)
1241
+ showActivityStatus Boolean @default(true)
1204
1242
  hiddenBashIds String[] @default([])
1205
- hideActivitySection Boolean @default(false)
1206
- allowLocationSharing Boolean @default(false)
1207
- defaultLandingPage String @default("dashboard")
1208
- contentDensity String @default("COMFORTABLE") // COMPACT, COMFORTABLE, SPACIOUS
1209
- fontScale String @default("MEDIUM") // SMALL, MEDIUM, LARGE
1210
- animationsEnabled Boolean @default(true)
1211
- useHighContrastMode Boolean @default(false)
1243
+ hideActivitySection Boolean @default(false)
1244
+ allowLocationSharing Boolean @default(false)
1245
+ defaultLandingPage String @default("dashboard")
1246
+ contentDensity String @default("COMFORTABLE") // COMPACT, COMFORTABLE, SPACIOUS
1247
+ fontScale String @default("MEDIUM") // SMALL, MEDIUM, LARGE
1248
+ animationsEnabled Boolean @default(true)
1249
+ useHighContrastMode Boolean @default(false)
1212
1250
  contentFilters String[] @default([])
1213
1251
  topicInterests String[] @default([])
1214
1252
  hideSeenContent Boolean @default(false)
1215
1253
  autoplayVideos Boolean @default(true)
1216
- contentSortPreference String @default("RECENT") // RECENT, POPULAR, RELEVANT
1254
+ contentSortPreference String @default("RECENT") // RECENT, POPULAR, RELEVANT
1217
1255
  contentLanguages String[] @default(["en"])
1218
1256
  showSensitiveContent Boolean @default(false)
1219
- defaultEventReminder Int @default(60) // Minutes before event (replaced by eventReminderTiming)
1220
- communicationFrequency String @default("NORMAL") // LOW, NORMAL, HIGH
1221
- preferredContactMethod String @default("EMAIL") // EMAIL, PUSH, SMS
1257
+ defaultEventReminder Int @default(60) // Minutes before event (replaced by eventReminderTiming)
1258
+ communicationFrequency String @default("NORMAL") // LOW, NORMAL, HIGH
1259
+ preferredContactMethod String @default("EMAIL") // EMAIL, PUSH, SMS
1222
1260
 
1223
1261
  @@map("user_preferences")
1224
1262
  }
@@ -1570,41 +1608,40 @@ model VolunteerService {
1570
1608
  }
1571
1609
 
1572
1610
  model EventService {
1573
- id String @id @default(cuid())
1611
+ id String @id @default(cuid())
1574
1612
 
1575
1613
  // General classification
1576
- eventServiceType EventServiceType // e.g. DecorAndDesign
1577
- eventServiceSubType String? // e.g. "BalloonArt"
1614
+ eventServiceType EventServiceType // e.g. DecorAndDesign
1615
+ eventServiceSubType String? // e.g. "BalloonArt"
1578
1616
  formatOptions ServiceFormatOption[] // Related formats for this subtype
1579
1617
 
1580
1618
  // Custom input support
1581
- isCustom Boolean @default(false)
1582
- customNote String?
1619
+ isCustom Boolean @default(false)
1620
+ customNote String?
1583
1621
 
1584
1622
  // Optional linked models
1585
- serviceRangeId String?
1586
- serviceRange ServiceRange? @relation(fields: [serviceRangeId], references: [id])
1587
- crowdSizeId String? @unique
1588
- crowdSize AmountOfGuests? @relation(fields: [crowdSizeId], references: [id], onDelete: Cascade)
1589
- service Service?
1590
- serviceId String?
1623
+ serviceRangeId String?
1624
+ serviceRange ServiceRange? @relation(fields: [serviceRangeId], references: [id])
1625
+ crowdSizeId String? @unique
1626
+ crowdSize AmountOfGuests? @relation(fields: [crowdSizeId], references: [id], onDelete: Cascade)
1627
+ service Service?
1628
+ serviceId String?
1591
1629
 
1592
1630
  // Other descriptors
1593
1631
  yearsOfExperience YearsOfExperience
1594
1632
  goodsOrServices String[]
1595
1633
  menuItems String?
1596
1634
  venueTypes String[]
1597
- secondaryVenueTypes String[] @default([])
1635
+ secondaryVenueTypes String[] @default([])
1598
1636
  }
1599
1637
 
1600
1638
  model ServiceFormatOption {
1601
- id String @id @default(cuid())
1602
- eventServiceId String
1603
- eventService EventService @relation(fields: [eventServiceId], references: [id], onDelete: Cascade)
1604
- format String // e.g. "BalloonGarlands", "BuffetStyle", "WeddingFlorals"
1639
+ id String @id @default(cuid())
1640
+ eventServiceId String
1641
+ eventService EventService @relation(fields: [eventServiceId], references: [id], onDelete: Cascade)
1642
+ format String // e.g. "BalloonGarlands", "BuffetStyle", "WeddingFlorals"
1605
1643
  }
1606
1644
 
1607
-
1608
1645
  model EntertainmentService {
1609
1646
  id String @id @default(cuid())
1610
1647
  serviceRangeId String?
@@ -1689,7 +1726,6 @@ enum VendorBidStatus {
1689
1726
  Paid
1690
1727
  }
1691
1728
 
1692
-
1693
1729
  model Exhibitor {
1694
1730
  id String @id @default(cuid())
1695
1731
  serviceRangeId String?
@@ -1784,19 +1820,19 @@ model Organization {
1784
1820
  }
1785
1821
 
1786
1822
  enum EventServiceType {
1787
- Financing
1788
- EventPlanningAndManagement
1789
- FoodAndBeverage
1790
- Cleaning
1791
- DecorAndDesign
1792
- RentalEquipment
1793
- MediaProductionAndCreative
1794
- AudioVisualSupport
1795
- HostingSupport
1796
- PromotionAndMarketing
1797
- Staffing
1798
- Transportation
1799
- Other
1823
+ Financing
1824
+ EventPlanningAndManagement
1825
+ FoodAndBeverage
1826
+ Cleaning
1827
+ DecorAndDesign
1828
+ RentalEquipment
1829
+ MediaProductionAndCreative
1830
+ AudioVisualSupport
1831
+ HostingSupport
1832
+ PromotionAndMarketing
1833
+ Staffing
1834
+ Transportation
1835
+ Other
1800
1836
  }
1801
1837
 
1802
1838
  enum FinancingSubType {
@@ -3232,7 +3268,7 @@ model ServiceBooking {
3232
3268
  bashEventId String?
3233
3269
  bashEvent BashEvent? @relation(fields: [bashEventId], references: [id])
3234
3270
 
3235
- // Vendor-specific booking fields
3271
+ // Vendor-specific booking fields
3236
3272
  isVendorBid Boolean @default(false)
3237
3273
  vendorBidAmountCents Int? // Custom bid amount for vendor bookings
3238
3274
  vendorEventDetails String? // Additional event details for vendor
@@ -59,10 +59,7 @@ import {
59
59
  VolunteerService,
60
60
  } from "@prisma/client";
61
61
  import { SERVICE_LINK_DATA_TO_INCLUDE } from "./definitions";
62
- import {
63
- RemoveCommonProperties,
64
- UnionFromArray
65
- } from "./utils/typeUtils";
62
+ import { RemoveCommonProperties, UnionFromArray } from "./utils/typeUtils";
66
63
 
67
64
  export interface ApiResponse<T> {
68
65
  data: T;
@@ -595,7 +592,7 @@ export type ServiceExtNoIds = Exclude<
595
592
  export interface EventServiceExt extends EventService {
596
593
  crowdSize?: AmountOfGuests;
597
594
  serviceRange?: ServiceRange;
598
- formatOptions?: ServiceFormatOption[]
595
+ formatOptions?: ServiceFormatOption[];
599
596
  }
600
597
 
601
598
  export interface EntertainmentServiceExt extends EntertainmentService {
@@ -643,7 +640,6 @@ export interface NotificationExt extends Notification {
643
640
  bashEvent?: BashEvent;
644
641
  creator?: PublicUser;
645
642
  eventTask?: EventTask;
646
- userAction?: string;
647
643
  service?: ServiceExt;
648
644
  serviceBooking?: ServiceBookingExt;
649
645
  invitation?: Invitation;
@@ -797,7 +793,7 @@ export interface UserExt extends User {
797
793
  preferences?: UserPreferences | null;
798
794
  stats?: UserStats | null;
799
795
  demerits?: Demerit[] | null;
800
-
796
+
801
797
  // Do not include in fetch as there could be thousands of these
802
798
  userSubscription?: UserSubscriptionExt | null;
803
799
  associatedBashes?: AssociatedBash[] | null;
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -276,10 +276,10 @@ export function utcOffsetMinutesToTimezone(utcOffsetMinutes: number) {
276
276
  return offsetString;
277
277
  }
278
278
 
279
- export function getLocalTimezone() {
280
- const localDateTime = DateTime.local();
281
- return utcOffsetMinutesToTimezone(localDateTime.offset);
282
- }
279
+ // export function getLocalTimezone() {
280
+ // const localDateTime = DateTime.local();
281
+ // return utcOffsetMinutesToTimezone(localDateTime.offset);
282
+ // }
283
283
 
284
284
  export function dateTimeFormatDateRange(
285
285
  startDateTimeArg: DateTime | null,
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -42,6 +42,12 @@ export function serviceBookingIsPending(booking: ServiceBookingExt): boolean {
42
42
  return booking.status === "Pending";
43
43
  }
44
44
 
45
+ export function serviceBookingHasApprovalDecision(
46
+ booking: ServiceBookingExt
47
+ ): boolean {
48
+ return serviceBookingIsDeclined(booking) || serviceBookingIsApproved(booking);
49
+ }
50
+
45
51
  export function serviceBookingCanBePaid(
46
52
  booking: ServiceBookingExt
47
53
  ): ValidationResult {
@@ -125,24 +131,6 @@ export function serviceBookingCanHaveApprovalDecision(
125
131
  return { valid: true };
126
132
  }
127
133
 
128
- export function serviceBookingHasApprovalDecision(
129
- booking: ServiceBookingExt
130
- ): ValidationResult {
131
- if (!serviceBookingIsRequest(booking)) {
132
- return {
133
- valid: false,
134
- errorMessage: "Only booking requests can have a decision.",
135
- };
136
- }
137
- if (serviceBookingIsPending(booking)) {
138
- return {
139
- valid: false,
140
- errorMessage: "This request has not been approved yet.",
141
- };
142
- }
143
- return { valid: true };
144
- }
145
-
146
134
  export function serviceBookingCanBeCanceled(
147
135
  service: ServiceExt,
148
136
  booking: ServiceBookingExt
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes