@bash-app/bash-common 30.6.0 → 30.7.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.7.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])
@@ -1203,7 +1204,7 @@ model Service {
1203
1204
  serviceLinks ServiceLink[]
1204
1205
 
1205
1206
  volunteerServiceId String? @unique
1206
- volunteerService VolunteerService? @relation(fields: [volunteerServiceId], references: [id], onDelete: Cascade)
1207
+ volunteerService VolunteerService? @relation("ServiceToVolunteer")
1207
1208
  eventServiceId String? @unique
1208
1209
  eventService EventService? @relation(fields: [eventServiceId], references: [id], onDelete: Cascade)
1209
1210
  entertainmentServiceId String? @unique
@@ -1251,26 +1252,38 @@ model StripeAccount {
1251
1252
  }
1252
1253
 
1253
1254
  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[]
1255
+ id String @id @default(cuid())
1256
+ userId String // Make required, not nullable
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
+ fullName String?
1262
+ address String?
1263
+ email String?
1264
+ phone String?
1265
+ agreedToAgreement Boolean @default(false) // Remove nullable
1266
+ description String @default("") // Make required with default
1267
+ status VolunteerServiceStatus @default(Draft) // Make required with default
1268
+ media Media[]
1269
+ skills String?
1270
+ experienceLevel String?
1271
+ preferredEventTypes String[] @default([])
1272
+ availability String[] @default([])
1273
+ physicalCapabilities String?
1274
+ equipment String?
1275
+ transportation String?
1276
+ emergencyContactName String?
1277
+ emergencyContactPhone String?
1270
1278
 
1271
1279
  serviceRatesAssociation ServiceRatesAssociation?
1272
1280
 
1273
- service Service?
1281
+ // Make this a required one-to-one relationship
1282
+ service Service @relation("ServiceToVolunteer", fields: [serviceId], references: [id])
1283
+ serviceId String @unique
1284
+
1285
+ // Add indexes for better performance
1286
+ @@index([userId])
1274
1287
  }
1275
1288
 
1276
1289
  model EventService {
@@ -1550,6 +1563,11 @@ enum ServiceRateType {
1550
1563
  // WEEKLY
1551
1564
  }
1552
1565
 
1566
+ enum ServiceAddonStatus {
1567
+ Enabled
1568
+ Disabled
1569
+ }
1570
+
1553
1571
  //can optionally be associated with a package
1554
1572
  model ServiceAddon {
1555
1573
  id String @id @default(cuid())
@@ -1558,6 +1576,8 @@ model ServiceAddon {
1558
1576
  priceCents Int
1559
1577
  quantity Int
1560
1578
 
1579
+ status ServiceAddonStatus @default(Enabled)
1580
+
1561
1581
  servicePackage ServicePackage? @relation(fields: [servicePackageId], references: [id], onDelete: Cascade)
1562
1582
  servicePackageId String?
1563
1583
 
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,