@bash-app/bash-common 29.18.3 → 29.18.5
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 +1 -1
- package/prisma/schema.prisma +18 -0
- package/src/definitions.ts +12 -11
- package/src/extendedSchemas.ts +35 -1
package/package.json
CHANGED
package/prisma/schema.prisma
CHANGED
|
@@ -882,6 +882,7 @@ model User {
|
|
|
882
882
|
documentID DocumentID?
|
|
883
883
|
comment BashComment[]
|
|
884
884
|
associatedBashes AssociatedBash[]
|
|
885
|
+
associatedServices AssociatedService[]
|
|
885
886
|
invitationsCreatedByMe Invitation[] @relation("InvitationsCreatedByMe")
|
|
886
887
|
invitationsSentToMe Invitation[] @relation("InvitationsSentToMe")
|
|
887
888
|
notificationsCreatedByMe BashNotification[] @relation("NotificationsCreatedByMe")
|
|
@@ -929,6 +930,21 @@ model AssociatedBash {
|
|
|
929
930
|
@@unique([ownerEmail, bashEventId])
|
|
930
931
|
}
|
|
931
932
|
|
|
933
|
+
model AssociatedService {
|
|
934
|
+
id String @id @default(cuid())
|
|
935
|
+
serviceId String
|
|
936
|
+
service Service @relation(fields: [serviceId], references: [id], onDelete: Cascade)
|
|
937
|
+
// referralId String? @unique
|
|
938
|
+
// referral Referral? @relation(fields: [referralId], references: [id])
|
|
939
|
+
ownerEmail String?
|
|
940
|
+
ownerUserId String?
|
|
941
|
+
owner User? @relation(fields: [ownerUserId], references: [id], onDelete: Cascade)
|
|
942
|
+
isOrganizer Boolean?
|
|
943
|
+
isFavorite Boolean?
|
|
944
|
+
|
|
945
|
+
@@unique([ownerEmail, serviceId])
|
|
946
|
+
}
|
|
947
|
+
|
|
932
948
|
//Common data for all services; 1-1 relation between each individual service model such as Venue
|
|
933
949
|
model Service {
|
|
934
950
|
id String @id @default(cuid())
|
|
@@ -948,6 +964,8 @@ model Service {
|
|
|
948
964
|
createdAt DateTime @default(now())
|
|
949
965
|
updatedAt DateTime @updatedAt
|
|
950
966
|
|
|
967
|
+
associatedServicesReferencingMe AssociatedService[]
|
|
968
|
+
|
|
951
969
|
serviceName String?
|
|
952
970
|
tagline String?
|
|
953
971
|
|
package/src/definitions.ts
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
User,
|
|
13
13
|
YearsOfExperience
|
|
14
14
|
} from "@prisma/client";
|
|
15
|
-
import { ServiceExt, CheckoutExt, PublicUser, VolunteerServiceExt} from "./extendedSchemas";
|
|
15
|
+
import { ServiceExt, CheckoutExt, PublicUser, VolunteerServiceExt, SERVICE_DATA_TO_INCLUDE} from "./extendedSchemas";
|
|
16
16
|
|
|
17
17
|
export const PASSWORD_MIN_LENGTH = 10 as const;
|
|
18
18
|
export const PASSWORD_REQUIREMENTS_REGEX = new RegExp(String.raw`^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{${PASSWORD_MIN_LENGTH},}$`);
|
|
@@ -77,6 +77,7 @@ export const DEFAULT_PRISMA_TTL_SECONDS = 60 as const;
|
|
|
77
77
|
export const PRISMA_MEDIA_TTL_SECONDS = 60 * 5; // 5 hours
|
|
78
78
|
export const PRISMA_USER_TTL_SECONDS = 60 * 7; // 7 hours
|
|
79
79
|
export const PRISMA_BASH_EVENT_TTL_SECONDS = 60 as const;
|
|
80
|
+
export const PRISMA_SERVICE_TTL_SECONDS = 60 as const;
|
|
80
81
|
|
|
81
82
|
export const MIN_PASSWORD_LENGTH = 10 as const;
|
|
82
83
|
|
|
@@ -92,16 +93,16 @@ export const SERVICE_LINK_DATA_TO_INCLUDE = {
|
|
|
92
93
|
link: true,
|
|
93
94
|
} satisfies Prisma.ServiceLinkInclude;
|
|
94
95
|
|
|
95
|
-
export const SERVICE_DATA_TO_INCLUDE = {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
} satisfies Prisma.ServiceInclude;
|
|
96
|
+
// export const SERVICE_DATA_TO_INCLUDE = {
|
|
97
|
+
// stripeAccount: true,
|
|
98
|
+
// availableDateTimes: true,
|
|
99
|
+
// targetAudience: true,
|
|
100
|
+
// media: true,
|
|
101
|
+
// serviceLinks: {
|
|
102
|
+
// include: SERVICE_LINK_DATA_TO_INCLUDE
|
|
103
|
+
// },
|
|
104
|
+
// // googleReviews: true,
|
|
105
|
+
// } satisfies Prisma.ServiceInclude;
|
|
105
106
|
|
|
106
107
|
// export type ServiceSpecificName = keyof Pick<
|
|
107
108
|
// ServiceExt,
|
package/src/extendedSchemas.ts
CHANGED
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
AmountOfGuests,
|
|
3
3
|
EventTask,
|
|
4
4
|
AssociatedBash,
|
|
5
|
+
AssociatedService,
|
|
5
6
|
BashEvent,
|
|
6
7
|
Invitation,
|
|
7
8
|
Ticket,
|
|
@@ -28,7 +29,7 @@ import {
|
|
|
28
29
|
Rate,
|
|
29
30
|
GoogleReview,
|
|
30
31
|
} from "@prisma/client";
|
|
31
|
-
import { UnionFromArray } from "./definitions";
|
|
32
|
+
import { SERVICE_LINK_DATA_TO_INCLUDE, UnionFromArray } from "./definitions";
|
|
32
33
|
|
|
33
34
|
export const FRONT_END_USER_DATA_TO_SELECT = {
|
|
34
35
|
id: true,
|
|
@@ -99,6 +100,25 @@ export const BASH_EVENT_DATA_TO_REMOVE: RemoveCommonProperties<BashEvent, BashEv
|
|
|
99
100
|
'amountOfGuests',
|
|
100
101
|
];
|
|
101
102
|
|
|
103
|
+
export const SERVICE_DATA_TO_INCLUDE = {
|
|
104
|
+
creator: {
|
|
105
|
+
select: FRONT_END_USER_DATA_TO_SELECT
|
|
106
|
+
},
|
|
107
|
+
targetAudience: true,
|
|
108
|
+
// amountOfGuests: true,
|
|
109
|
+
// recurrence: true,
|
|
110
|
+
// ticketTiers: {
|
|
111
|
+
// include: TICKET_TIER_DATA_TO_INCLUDE
|
|
112
|
+
// },
|
|
113
|
+
// eventTasks: true,
|
|
114
|
+
media: true,
|
|
115
|
+
stripeAccount: true,
|
|
116
|
+
availableDateTimes: true,
|
|
117
|
+
serviceLinks: {
|
|
118
|
+
include: SERVICE_LINK_DATA_TO_INCLUDE
|
|
119
|
+
},
|
|
120
|
+
} satisfies Prisma.ServiceInclude;
|
|
121
|
+
|
|
102
122
|
export interface BashNotificationExt extends BashNotification {
|
|
103
123
|
creator?: PublicUser;
|
|
104
124
|
bashEvent?: BashEvent;
|
|
@@ -257,6 +277,11 @@ export interface AssociatedBashExt extends AssociatedBash {
|
|
|
257
277
|
invitation: InvitationExt;
|
|
258
278
|
}
|
|
259
279
|
|
|
280
|
+
export interface AssociatedServiceExt extends AssociatedService {
|
|
281
|
+
service: ServiceExt;
|
|
282
|
+
// invitation: InvitationExt;
|
|
283
|
+
}
|
|
284
|
+
|
|
260
285
|
export const ASSOCIATED_BASH_DATA_TO_INCLUDE = {
|
|
261
286
|
bashEvent: {
|
|
262
287
|
include: BASH_EVENT_DATA_TO_INCLUDE
|
|
@@ -266,6 +291,15 @@ export const ASSOCIATED_BASH_DATA_TO_INCLUDE = {
|
|
|
266
291
|
}
|
|
267
292
|
} satisfies Prisma.AssociatedBashInclude;
|
|
268
293
|
|
|
294
|
+
export const ASSOCIATED_SERVICE_DATA_TO_INCLUDE = {
|
|
295
|
+
service: {
|
|
296
|
+
include: SERVICE_DATA_TO_INCLUDE
|
|
297
|
+
},
|
|
298
|
+
// invitation: {
|
|
299
|
+
// include: INVITATION_DATA_TO_INCLUDE
|
|
300
|
+
// }
|
|
301
|
+
} satisfies Prisma.AssociatedServiceInclude;
|
|
302
|
+
|
|
269
303
|
export interface TicketTierExt extends TicketTier {
|
|
270
304
|
bashEvent: BashEvent;
|
|
271
305
|
tickets: TicketExt[];
|