@bash-app/bash-common 29.18.6 → 29.18.7
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 +0 -45
- package/src/extendedSchemas.ts +47 -0
package/package.json
CHANGED
package/src/definitions.ts
CHANGED
|
@@ -115,51 +115,6 @@ export const SERVICE_LINK_DATA_TO_INCLUDE = {
|
|
|
115
115
|
// "organization"
|
|
116
116
|
// >;
|
|
117
117
|
|
|
118
|
-
// Define the keys and values in a single object
|
|
119
|
-
const serviceKeysObject = {
|
|
120
|
-
eventService: true,
|
|
121
|
-
entertainmentService: true,
|
|
122
|
-
vendor: true,
|
|
123
|
-
exhibitor: true,
|
|
124
|
-
sponsor: true,
|
|
125
|
-
venue: true,
|
|
126
|
-
organization: true,
|
|
127
|
-
} as const;
|
|
128
|
-
|
|
129
|
-
export type ServiceSpecificName = keyof typeof serviceKeysObject;
|
|
130
|
-
|
|
131
|
-
const serviceKeysArray = Object.keys(serviceKeysObject);
|
|
132
|
-
|
|
133
|
-
// Create the final object dynamically
|
|
134
|
-
function createAllTrueObject<T extends string>(keys: T[]): Record<T, true> {
|
|
135
|
-
return keys.reduce((acc, key) => {
|
|
136
|
-
acc[key] = true;
|
|
137
|
-
return acc;
|
|
138
|
-
}, {} as Record<T, true>);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
export type ServiceSpecificType = ServiceExt[ServiceSpecificName];
|
|
142
|
-
|
|
143
|
-
export const serviceTypeToField = (serviceType : ServiceTypes) : ServiceSpecificName => {
|
|
144
|
-
const specificServiceMap : Record<ServiceTypes, ServiceSpecificName> = {
|
|
145
|
-
"EventServices": "eventService",
|
|
146
|
-
"EntertainmentServices": "entertainmentService",
|
|
147
|
-
"Vendors": "vendor",
|
|
148
|
-
"Exhibitors": "exhibitor",
|
|
149
|
-
"Sponsors": "sponsor",
|
|
150
|
-
"Venues": "venue",
|
|
151
|
-
"Organizations": "organization"
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
return specificServiceMap[serviceType];
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
//full service data to include, includes specific service data
|
|
158
|
-
export const SERVICE_FULL_DATA_TO_INCLUDE = {
|
|
159
|
-
...SERVICE_DATA_TO_INCLUDE,
|
|
160
|
-
...createAllTrueObject(serviceKeysArray)
|
|
161
|
-
} satisfies Prisma.ServiceInclude;
|
|
162
|
-
|
|
163
118
|
export const VENUE_DATA_TO_INCLUDE = {
|
|
164
119
|
|
|
165
120
|
} satisfies Prisma.VenueInclude;
|
package/src/extendedSchemas.ts
CHANGED
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
Coordinates,
|
|
29
29
|
Rate,
|
|
30
30
|
GoogleReview,
|
|
31
|
+
ServiceTypes,
|
|
31
32
|
} from "@prisma/client";
|
|
32
33
|
import { SERVICE_LINK_DATA_TO_INCLUDE, UnionFromArray } from "./definitions";
|
|
33
34
|
|
|
@@ -119,6 +120,52 @@ export const SERVICE_DATA_TO_INCLUDE = {
|
|
|
119
120
|
},
|
|
120
121
|
} satisfies Prisma.ServiceInclude;
|
|
121
122
|
|
|
123
|
+
// Create the final object dynamically
|
|
124
|
+
function createAllTrueObject<T extends string>(keys: T[]): Record<T, true> {
|
|
125
|
+
return keys.reduce((acc, key) => {
|
|
126
|
+
acc[key] = true;
|
|
127
|
+
return acc;
|
|
128
|
+
}, {} as Record<T, true>);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Define the keys and values in a single object
|
|
132
|
+
const serviceKeysObject = {
|
|
133
|
+
eventService: true,
|
|
134
|
+
entertainmentService: true,
|
|
135
|
+
vendor: true,
|
|
136
|
+
exhibitor: true,
|
|
137
|
+
sponsor: true,
|
|
138
|
+
venue: true,
|
|
139
|
+
organization: true,
|
|
140
|
+
} as const;
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
export type ServiceSpecificName = keyof typeof serviceKeysObject;
|
|
144
|
+
|
|
145
|
+
const serviceKeysArray = Object.keys(serviceKeysObject);
|
|
146
|
+
|
|
147
|
+
export type ServiceSpecificType = ServiceExt[ServiceSpecificName];
|
|
148
|
+
|
|
149
|
+
export const serviceTypeToField = (serviceType : ServiceTypes) : ServiceSpecificName => {
|
|
150
|
+
const specificServiceMap : Record<ServiceTypes, ServiceSpecificName> = {
|
|
151
|
+
"EventServices": "eventService",
|
|
152
|
+
"EntertainmentServices": "entertainmentService",
|
|
153
|
+
"Vendors": "vendor",
|
|
154
|
+
"Exhibitors": "exhibitor",
|
|
155
|
+
"Sponsors": "sponsor",
|
|
156
|
+
"Venues": "venue",
|
|
157
|
+
"Organizations": "organization"
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
return specificServiceMap[serviceType];
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
//full service data to include, includes specific service data
|
|
164
|
+
export const SERVICE_FULL_DATA_TO_INCLUDE = {
|
|
165
|
+
...SERVICE_DATA_TO_INCLUDE,
|
|
166
|
+
...createAllTrueObject(serviceKeysArray)
|
|
167
|
+
} satisfies Prisma.ServiceInclude;
|
|
168
|
+
|
|
122
169
|
export interface BashNotificationExt extends BashNotification {
|
|
123
170
|
creator?: PublicUser;
|
|
124
171
|
bashEvent?: BashEvent;
|