@bash-app/bash-common 29.14.1 → 29.14.2
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/src/definitions.ts +56 -27
package/package.json
CHANGED
package/src/definitions.ts
CHANGED
|
@@ -102,6 +102,62 @@ export const SERVICE_DATA_TO_INCLUDE = {
|
|
|
102
102
|
},
|
|
103
103
|
} satisfies Prisma.ServiceInclude;
|
|
104
104
|
|
|
105
|
+
// export type ServiceSpecificName = keyof Pick<
|
|
106
|
+
// ServiceExt,
|
|
107
|
+
// "eventService" |
|
|
108
|
+
// "entertainmentService" |
|
|
109
|
+
// "vendor" |
|
|
110
|
+
// "exhibitor" |
|
|
111
|
+
// "sponsor" |
|
|
112
|
+
// "venue" |
|
|
113
|
+
// "organization"
|
|
114
|
+
// >;
|
|
115
|
+
|
|
116
|
+
// Define the keys and values in a single object
|
|
117
|
+
const serviceKeysObject = {
|
|
118
|
+
eventService: true,
|
|
119
|
+
entertainmentService: true,
|
|
120
|
+
vendor: true,
|
|
121
|
+
exhibitor: true,
|
|
122
|
+
sponsor: true,
|
|
123
|
+
venue: true,
|
|
124
|
+
organization: true,
|
|
125
|
+
} as const;
|
|
126
|
+
|
|
127
|
+
export type ServiceSpecificName = keyof typeof serviceKeysObject;
|
|
128
|
+
|
|
129
|
+
const serviceKeysArray = Object.keys(serviceKeysObject);
|
|
130
|
+
|
|
131
|
+
// Create the final object dynamically
|
|
132
|
+
function createAllTrueObject<T extends string>(keys: T[]): Record<T, true> {
|
|
133
|
+
return keys.reduce((acc, key) => {
|
|
134
|
+
acc[key] = true;
|
|
135
|
+
return acc;
|
|
136
|
+
}, {} as Record<T, true>);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export type ServiceSpecificType = ServiceExt[ServiceSpecificName];
|
|
140
|
+
|
|
141
|
+
export const serviceTypeToField = (serviceType : ServiceTypes) : ServiceSpecificName => {
|
|
142
|
+
const specificServiceMap : Record<ServiceTypes, ServiceSpecificName> = {
|
|
143
|
+
"EventServices": "eventService",
|
|
144
|
+
"EntertainmentServices": "entertainmentService",
|
|
145
|
+
"Vendors": "vendor",
|
|
146
|
+
"Exhibitors": "exhibitor",
|
|
147
|
+
"Sponsors": "sponsor",
|
|
148
|
+
"Venues": "venue",
|
|
149
|
+
"Organizations": "organization"
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
return specificServiceMap[serviceType];
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
//full service data to include, includes specific service data
|
|
156
|
+
export const SERVICE_FULL_DATA_TO_INCLUDE = {
|
|
157
|
+
...SERVICE_DATA_TO_INCLUDE,
|
|
158
|
+
...createAllTrueObject(serviceKeysArray)
|
|
159
|
+
} satisfies Prisma.ServiceInclude;
|
|
160
|
+
|
|
105
161
|
export const VENUE_DATA_TO_INCLUDE = {
|
|
106
162
|
|
|
107
163
|
} satisfies Prisma.VenueInclude;
|
|
@@ -523,31 +579,4 @@ export interface IAddress {
|
|
|
523
579
|
state: string;
|
|
524
580
|
zipCode: string;
|
|
525
581
|
country: string;
|
|
526
|
-
}
|
|
527
|
-
|
|
528
|
-
export type ServiceSpecificName = keyof Pick<
|
|
529
|
-
ServiceExt,
|
|
530
|
-
"eventService" |
|
|
531
|
-
"entertainmentService" |
|
|
532
|
-
"vendor" |
|
|
533
|
-
"exhibitor" |
|
|
534
|
-
"sponsor" |
|
|
535
|
-
"venue" |
|
|
536
|
-
"organization"
|
|
537
|
-
>;
|
|
538
|
-
|
|
539
|
-
export type ServiceSpecificType = ServiceExt[ServiceSpecificName];
|
|
540
|
-
|
|
541
|
-
export const serviceTypeToField = (serviceType : ServiceTypes) : ServiceSpecificName => {
|
|
542
|
-
const specificServiceMap : Record<ServiceTypes, ServiceSpecificName> = {
|
|
543
|
-
"EventServices": "eventService",
|
|
544
|
-
"EntertainmentServices": "entertainmentService",
|
|
545
|
-
"Vendors": "vendor",
|
|
546
|
-
"Exhibitors": "exhibitor",
|
|
547
|
-
"Sponsors": "sponsor",
|
|
548
|
-
"Venues": "venue",
|
|
549
|
-
"Organizations": "organization"
|
|
550
|
-
};
|
|
551
|
-
|
|
552
|
-
return specificServiceMap[serviceType];
|
|
553
582
|
}
|