@bash-app/bash-common 29.36.1 → 29.37.1
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 -8
- package/src/extendedSchemas.ts +37 -10
package/package.json
CHANGED
package/prisma/schema.prisma
CHANGED
|
@@ -342,14 +342,6 @@ enum UserSubscriptionType {
|
|
|
342
342
|
VIP
|
|
343
343
|
}
|
|
344
344
|
|
|
345
|
-
model ServiceSubscription {
|
|
346
|
-
id String @id @default(cuid())
|
|
347
|
-
ownerId String
|
|
348
|
-
owner User @relation(fields: [ownerId], references: [id], onDelete: Cascade)
|
|
349
|
-
slots Int @default(0)
|
|
350
|
-
stripeSubscriptionId String?
|
|
351
|
-
}
|
|
352
|
-
|
|
353
345
|
enum BookingStatus {
|
|
354
346
|
Cancelled
|
|
355
347
|
Completed
|
|
@@ -942,6 +934,22 @@ enum ServiceCancelationPolicy {
|
|
|
942
934
|
Standard30Day
|
|
943
935
|
}
|
|
944
936
|
|
|
937
|
+
model ServiceSubscription {
|
|
938
|
+
id String @id @default(cuid())
|
|
939
|
+
ownerId String
|
|
940
|
+
owner User @relation(fields: [ownerId], references: [id], onDelete: Cascade)
|
|
941
|
+
slots Int @default(0)
|
|
942
|
+
stripeSubscriptionId String?
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
model ServiceListingSubscription {
|
|
946
|
+
id String @id @default(cuid())
|
|
947
|
+
stripeSubscriptionId String?
|
|
948
|
+
|
|
949
|
+
serviceId String? @unique
|
|
950
|
+
service Service? @relation(fields: [serviceId], references: [id], onDelete: Restrict)
|
|
951
|
+
}
|
|
952
|
+
|
|
945
953
|
// Common data for all services; 1-1 relation between each individual service model such as Venue
|
|
946
954
|
model Service {
|
|
947
955
|
id String @id @default(cuid())
|
|
@@ -1002,6 +1010,8 @@ model Service {
|
|
|
1002
1010
|
stripeAccountId String?
|
|
1003
1011
|
stripeAccount StripeAccount? @relation(fields: [stripeAccountId], references: [id], onDelete: Restrict)
|
|
1004
1012
|
|
|
1013
|
+
serviceListingSubscription ServiceListingSubscription?
|
|
1014
|
+
|
|
1005
1015
|
targetAudienceId String? @unique
|
|
1006
1016
|
targetAudience TargetAudience? @relation(fields: [targetAudienceId], references: [id], onDelete: Cascade)
|
|
1007
1017
|
|
package/src/extendedSchemas.ts
CHANGED
|
@@ -36,6 +36,7 @@ import {
|
|
|
36
36
|
ServiceSpecialRates,
|
|
37
37
|
ServiceAddon,
|
|
38
38
|
ServicePackage,
|
|
39
|
+
ServiceListingSubscription,
|
|
39
40
|
} from "@prisma/client";
|
|
40
41
|
import { SERVICE_LINK_DATA_TO_INCLUDE, UnionFromArray, VENUE_DATA_TO_INCLUDE } from "./definitions";
|
|
41
42
|
|
|
@@ -113,7 +114,8 @@ export interface ServiceExt extends Service {
|
|
|
113
114
|
owner?: PublicUser | null;
|
|
114
115
|
creator?: PublicUser | null;
|
|
115
116
|
|
|
116
|
-
stripeAccount?:
|
|
117
|
+
stripeAccount?: PublicStripeAccount | null;
|
|
118
|
+
serviceListingSubscription?: PublicServiceListingSubscription | null;
|
|
117
119
|
|
|
118
120
|
// availableDateTimes?: Availability[];
|
|
119
121
|
|
|
@@ -287,6 +289,29 @@ export const SERVICE_RATES_ASSOCIATION_DATA_TO_INCLUDE = {
|
|
|
287
289
|
media: true
|
|
288
290
|
} satisfies Prisma.ServiceRatesAssociationInclude;
|
|
289
291
|
|
|
292
|
+
//------------Stripe Accounts--------------
|
|
293
|
+
export const STRIPE_ACCOUNT_DATA_TO_INCLUDE = {
|
|
294
|
+
logo: true,
|
|
295
|
+
owner: {
|
|
296
|
+
select: FRONT_END_USER_DATA_TO_SELECT
|
|
297
|
+
}
|
|
298
|
+
} satisfies Prisma.StripeAccountInclude;
|
|
299
|
+
|
|
300
|
+
export const PUBLIC_STRIPE_ACCOUNT_DATA_TO_SELECT = {
|
|
301
|
+
logo: true,
|
|
302
|
+
logoId: true,
|
|
303
|
+
createdAt: true,
|
|
304
|
+
updatedAt: true
|
|
305
|
+
} satisfies Prisma.StripeAccountSelect;
|
|
306
|
+
|
|
307
|
+
export const PUBLIC_SERVICE_LISTING_SUBSCRIPTION_DATA_TO_SELECT = {
|
|
308
|
+
serviceId: true
|
|
309
|
+
} satisfies Prisma.ServiceListingSubscriptionSelect;
|
|
310
|
+
|
|
311
|
+
export interface StripeAccountExt extends StripeAccount {
|
|
312
|
+
logo?: Media | null;
|
|
313
|
+
}
|
|
314
|
+
|
|
290
315
|
export const SERVICE_DATA_TO_INCLUDE = {
|
|
291
316
|
creator: {
|
|
292
317
|
select: FRONT_END_USER_DATA_TO_SELECT
|
|
@@ -302,7 +327,13 @@ export const SERVICE_DATA_TO_INCLUDE = {
|
|
|
302
327
|
// },
|
|
303
328
|
// eventTasks: true,
|
|
304
329
|
media: true,
|
|
305
|
-
stripeAccount:
|
|
330
|
+
stripeAccount: {
|
|
331
|
+
include: STRIPE_ACCOUNT_DATA_TO_INCLUDE,
|
|
332
|
+
select: PUBLIC_STRIPE_ACCOUNT_DATA_TO_SELECT
|
|
333
|
+
},
|
|
334
|
+
serviceListingSubscription: {
|
|
335
|
+
select: PUBLIC_SERVICE_LISTING_SUBSCRIPTION_DATA_TO_SELECT
|
|
336
|
+
},
|
|
306
337
|
// availableDateTimes: true,
|
|
307
338
|
serviceLinks: {
|
|
308
339
|
include: SERVICE_LINK_DATA_TO_INCLUDE
|
|
@@ -397,14 +428,6 @@ export const EVENT_TASK_DATA_TO_INCLUDE = {
|
|
|
397
428
|
} satisfies Prisma.EventTaskInclude;
|
|
398
429
|
|
|
399
430
|
|
|
400
|
-
//------------Stripe Accounts--------------
|
|
401
|
-
export const STRIPE_ACCOUNT_DATA_TO_INCLUDE = {
|
|
402
|
-
logo: true
|
|
403
|
-
} satisfies Prisma.StripeAccountInclude;
|
|
404
|
-
|
|
405
|
-
export interface StripeAccountExt extends StripeAccount {
|
|
406
|
-
logo?: Media | null;
|
|
407
|
-
}
|
|
408
431
|
export interface InvitationExt extends Invitation {
|
|
409
432
|
creator: PublicUser;
|
|
410
433
|
sentTo: PublicUser;
|
|
@@ -523,3 +546,7 @@ export const USER_DATA_SELECT_REVIEWS_COMMENTS = {
|
|
|
523
546
|
|
|
524
547
|
export type PublicUser = Pick<UserExt, keyof typeof FRONT_END_USER_DATA_TO_SELECT>
|
|
525
548
|
& Partial<Pick<UserExt, keyof typeof USER_DATA_SELECT_REVIEWS_COMMENTS>>;
|
|
549
|
+
|
|
550
|
+
export type PublicStripeAccount = Pick<StripeAccountExt, keyof typeof PUBLIC_STRIPE_ACCOUNT_DATA_TO_SELECT>;
|
|
551
|
+
|
|
552
|
+
export type PublicServiceListingSubscription = Pick<ServiceListingSubscription, keyof typeof PUBLIC_SERVICE_LISTING_SUBSCRIPTION_DATA_TO_SELECT>;
|