@bash-app/bash-common 30.6.0 → 30.8.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": "30.6.0",
3
+ "version": "30.8.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",
@@ -113,6 +113,7 @@ enum TaskStatus {
113
113
  Rejected
114
114
  Completed
115
115
  Assigned
116
+ Pending
116
117
  Open
117
118
  }
118
119
 
@@ -214,7 +215,7 @@ model BashNotification {
214
215
  reminders Reminder[]
215
216
  redirectUrl String?
216
217
 
217
- @@unique([creatorId, email, bashEventId])
218
+ @@unique([creatorId, email, bashEventId, taskId])
218
219
  @@unique([creatorId, email, invitationId])
219
220
  @@unique([creatorId, email, serviceBookingId])
220
221
  @@index([creatorId])
@@ -244,8 +245,14 @@ model Invitation {
244
245
  @@index([email])
245
246
  }
246
247
 
248
+ enum BashEventSource {
249
+ Bash
250
+ Eventbrite
251
+ }
252
+
247
253
  model BashEvent {
248
254
  id String @id @default(cuid())
255
+ source BashEventSource @default(Bash)
249
256
  title String
250
257
  creatorId String
251
258
  creator User @relation("CreatedEvent", fields: [creatorId], references: [id], onDelete: Cascade)
@@ -1203,7 +1210,7 @@ model Service {
1203
1210
  serviceLinks ServiceLink[]
1204
1211
 
1205
1212
  volunteerServiceId String? @unique
1206
- volunteerService VolunteerService? @relation(fields: [volunteerServiceId], references: [id], onDelete: Cascade)
1213
+ volunteerService VolunteerService? @relation("ServiceToVolunteer")
1207
1214
  eventServiceId String? @unique
1208
1215
  eventService EventService? @relation(fields: [eventServiceId], references: [id], onDelete: Cascade)
1209
1216
  entertainmentServiceId String? @unique
@@ -1251,26 +1258,38 @@ model StripeAccount {
1251
1258
  }
1252
1259
 
1253
1260
  model VolunteerService {
1254
- id String @id @default(cuid())
1255
- // service Service
1256
- userId String?
1257
- user User? @relation(fields: [userId], references: [id])
1258
- serviceRangeId String?
1259
- serviceRange ServiceRange? @relation(fields: [serviceRangeId], references: [id])
1260
- links Link[] @relation("VolunteerServiceLinks")
1261
- // availableDateTimes ServiceAvailability[] @relation("AvailableDateTimes")
1262
- fullName String?
1263
- address String?
1264
- email String?
1265
- phone String?
1266
- agreedToAgreement Boolean? @default(false)
1267
- description String?
1268
- status VolunteerServiceStatus?
1269
- media Media[]
1261
+ id String @id @default(cuid())
1262
+ userId String // Make required, not nullable
1263
+ user User @relation(fields: [userId], references: [id])
1264
+ serviceRangeId String?
1265
+ serviceRange ServiceRange? @relation(fields: [serviceRangeId], references: [id])
1266
+ links Link[] @relation("VolunteerServiceLinks")
1267
+ fullName String?
1268
+ address String?
1269
+ email String?
1270
+ phone String?
1271
+ agreedToAgreement Boolean @default(false) // Remove nullable
1272
+ description String @default("") // Make required with default
1273
+ status VolunteerServiceStatus @default(Draft) // Make required with default
1274
+ media Media[]
1275
+ skills String?
1276
+ experienceLevel String?
1277
+ preferredEventTypes String[] @default([])
1278
+ availability String[] @default([])
1279
+ physicalCapabilities String?
1280
+ equipment String?
1281
+ transportation String?
1282
+ emergencyContactName String?
1283
+ emergencyContactPhone String?
1270
1284
 
1271
1285
  serviceRatesAssociation ServiceRatesAssociation?
1272
1286
 
1273
- service Service?
1287
+ // Make this a required one-to-one relationship
1288
+ service Service @relation("ServiceToVolunteer", fields: [serviceId], references: [id])
1289
+ serviceId String @unique
1290
+
1291
+ // Add indexes for better performance
1292
+ @@index([userId])
1274
1293
  }
1275
1294
 
1276
1295
  model EventService {
@@ -1550,6 +1569,11 @@ enum ServiceRateType {
1550
1569
  // WEEKLY
1551
1570
  }
1552
1571
 
1572
+ enum ServiceAddonStatus {
1573
+ Enabled
1574
+ Disabled
1575
+ }
1576
+
1553
1577
  //can optionally be associated with a package
1554
1578
  model ServiceAddon {
1555
1579
  id String @id @default(cuid())
@@ -1558,6 +1582,8 @@ model ServiceAddon {
1558
1582
  priceCents Int
1559
1583
  quantity Int
1560
1584
 
1585
+ status ServiceAddonStatus @default(Enabled)
1586
+
1561
1587
  servicePackage ServicePackage? @relation(fields: [servicePackageId], references: [id], onDelete: Cascade)
1562
1588
  servicePackageId String?
1563
1589
 
package/src/index.ts CHANGED
@@ -15,6 +15,7 @@ export * from "./utils/arrayUtils";
15
15
  export * from "./utils/promoCodesUtils";
16
16
  export * from "./utils/userPromoCodeUtils";
17
17
  export * from "./utils/userSubscriptionUtils";
18
+ export * from "./utils/service/regexUtils";
18
19
  export * from "./utils/service/serviceUtils";
19
20
  export * from "./utils/service/venueUtils";
20
21
  export * from "./utils/service/attendeeOptionUtils";
@@ -0,0 +1,11 @@
1
+ export function isPositiveInt(str: string): boolean {
2
+ return /^\d*$/.test(str);
3
+ }
4
+
5
+ export function isPositiveFloat(str: string): boolean {
6
+ return /^\d*\.?\d*$/.test(str);
7
+ }
8
+
9
+ export function isPrice(str: string): boolean {
10
+ return /^\d*\.?\d{0,2}$/.test(str);
11
+ }
@@ -64,7 +64,7 @@ export const SERVICE_CANCELLATION_POLICY_DATA: ServiceCancellationPolicyMap = {
64
64
  ],
65
65
  },
66
66
  [ServiceCancellationPolicyOption.Standard90Day]: {
67
- name: "Very Flexible",
67
+ name: "Standard 90 Day",
68
68
  refundPolicy: [
69
69
  {
70
70
  days: 90,