@bash-app/bash-common 29.37.0 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bash-app/bash-common",
3
- "version": "29.37.0",
3
+ "version": "29.37.1",
4
4
  "description": "Common data and scripts to use on the frontend and backend",
5
5
  "type": "module",
6
6
  "main": "src/index.ts",
@@ -943,9 +943,11 @@ model ServiceSubscription {
943
943
  }
944
944
 
945
945
  model ServiceListingSubscription {
946
- id String @id @default(cuid())
946
+ id String @id @default(cuid())
947
947
  stripeSubscriptionId String?
948
- service Service?
948
+
949
+ serviceId String? @unique
950
+ service Service? @relation(fields: [serviceId], references: [id], onDelete: Restrict)
949
951
  }
950
952
 
951
953
  // Common data for all services; 1-1 relation between each individual service model such as Venue
@@ -1008,8 +1010,7 @@ model Service {
1008
1010
  stripeAccountId String?
1009
1011
  stripeAccount StripeAccount? @relation(fields: [stripeAccountId], references: [id], onDelete: Restrict)
1010
1012
 
1011
- serviceListingSubscriptionId String? @unique
1012
- serviceListingSubscription ServiceListingSubscription? @relation(fields: [serviceListingSubscriptionId], references: [id])
1013
+ serviceListingSubscription ServiceListingSubscription?
1013
1014
 
1014
1015
  targetAudienceId String? @unique
1015
1016
  targetAudience TargetAudience? @relation(fields: [targetAudienceId], references: [id], onDelete: Cascade)
@@ -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?: StripeAccount | null;
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: true,
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>;