@bash-app/bash-common 29.14.0 → 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 +58 -2
package/package.json
CHANGED
package/src/definitions.ts
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
DayOfWeek,
|
|
7
7
|
Prisma,
|
|
8
8
|
Rate,
|
|
9
|
+
ServiceTypes,
|
|
9
10
|
Ticket,
|
|
10
11
|
TicketTier,
|
|
11
12
|
User,
|
|
@@ -101,6 +102,62 @@ export const SERVICE_DATA_TO_INCLUDE = {
|
|
|
101
102
|
},
|
|
102
103
|
} satisfies Prisma.ServiceInclude;
|
|
103
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
|
+
|
|
104
161
|
export const VENUE_DATA_TO_INCLUDE = {
|
|
105
162
|
|
|
106
163
|
} satisfies Prisma.VenueInclude;
|
|
@@ -515,7 +572,6 @@ type AllKeysUnion<T> = T extends object
|
|
|
515
572
|
export type AllKeys<T> = AllKeysUnion<T>[];
|
|
516
573
|
|
|
517
574
|
|
|
518
|
-
|
|
519
575
|
export interface IAddress {
|
|
520
576
|
place?: string;
|
|
521
577
|
street: string;
|
|
@@ -523,4 +579,4 @@ export interface IAddress {
|
|
|
523
579
|
state: string;
|
|
524
580
|
zipCode: string;
|
|
525
581
|
country: string;
|
|
526
|
-
}
|
|
582
|
+
}
|