@bash-app/bash-common 29.22.2 → 29.22.4
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 +0 -1
- package/src/extendedSchemas.ts +31 -27
- package/src/utils/dateTimeUtils.ts +6 -0
package/package.json
CHANGED
package/prisma/schema.prisma
CHANGED
package/src/extendedSchemas.ts
CHANGED
|
@@ -108,6 +108,32 @@ export const BASH_EVENT_DATA_TO_REMOVE: RemoveCommonProperties<BashEvent, BashEv
|
|
|
108
108
|
'amountOfGuests',
|
|
109
109
|
];
|
|
110
110
|
|
|
111
|
+
export const SERVICE_PACKAGE_DATA_TO_INCLUDE = {
|
|
112
|
+
serviceAddons: true
|
|
113
|
+
} satisfies Prisma.ServicePackageInclude;
|
|
114
|
+
|
|
115
|
+
export const SERVICE_DAILYRATES_DATA_TO_INCLUDE = {
|
|
116
|
+
serviceRate: true
|
|
117
|
+
} satisfies Prisma.ServiceDailyRatesInclude;
|
|
118
|
+
|
|
119
|
+
export const SERVICE_SPECIALRATES_DATA_TO_INCLUDE = {
|
|
120
|
+
serviceRate: true
|
|
121
|
+
} satisfies Prisma.ServiceSpecialRatesInclude;
|
|
122
|
+
|
|
123
|
+
export const SERVICE_RATES_ASSOCIATION_DATA_TO_INCLUDE = {
|
|
124
|
+
serviceGeneralRates: true,
|
|
125
|
+
serviceDailyRates: {
|
|
126
|
+
include: SERVICE_DAILYRATES_DATA_TO_INCLUDE
|
|
127
|
+
},
|
|
128
|
+
serviceSpecialRates: {
|
|
129
|
+
include: SERVICE_SPECIALRATES_DATA_TO_INCLUDE
|
|
130
|
+
},
|
|
131
|
+
addons: true,
|
|
132
|
+
packages: {
|
|
133
|
+
include: SERVICE_PACKAGE_DATA_TO_INCLUDE
|
|
134
|
+
},
|
|
135
|
+
} satisfies Prisma.ServiceRatesAssociationInclude;
|
|
136
|
+
|
|
111
137
|
export const SERVICE_DATA_TO_INCLUDE = {
|
|
112
138
|
creator: {
|
|
113
139
|
select: FRONT_END_USER_DATA_TO_SELECT
|
|
@@ -128,7 +154,9 @@ export const SERVICE_DATA_TO_INCLUDE = {
|
|
|
128
154
|
serviceLinks: {
|
|
129
155
|
include: SERVICE_LINK_DATA_TO_INCLUDE
|
|
130
156
|
},
|
|
131
|
-
serviceRatesAssociation:
|
|
157
|
+
serviceRatesAssociation: {
|
|
158
|
+
include: SERVICE_RATES_ASSOCIATION_DATA_TO_INCLUDE
|
|
159
|
+
}
|
|
132
160
|
} satisfies Prisma.ServiceInclude;
|
|
133
161
|
|
|
134
162
|
// Create the final object dynamically
|
|
@@ -177,32 +205,6 @@ export const SERVICE_FULL_DATA_TO_INCLUDE = {
|
|
|
177
205
|
...createAllTrueObject(serviceKeysArray)
|
|
178
206
|
} satisfies Prisma.ServiceInclude;
|
|
179
207
|
|
|
180
|
-
export const SERVICE_PACKAGE_DATA_TO_INCLUDE = {
|
|
181
|
-
serviceAddons: true
|
|
182
|
-
} satisfies Prisma.ServicePackageInclude;
|
|
183
|
-
|
|
184
|
-
export const SERVICE_DAILYRATES_DATA_TO_INCLUDE = {
|
|
185
|
-
serviceRate: true
|
|
186
|
-
} satisfies Prisma.ServiceDailyRatesInclude;
|
|
187
|
-
|
|
188
|
-
export const SERVICE_SPECIALRATES_DATA_TO_INCLUDE = {
|
|
189
|
-
serviceRate: true
|
|
190
|
-
} satisfies Prisma.ServiceSpecialRatesInclude;
|
|
191
|
-
|
|
192
|
-
export const SERVICE_RATES_ASSOCIATION_DATA_TO_INCLUDE = {
|
|
193
|
-
serviceGeneralRates: true,
|
|
194
|
-
serviceDailyRates: {
|
|
195
|
-
include: SERVICE_DAILYRATES_DATA_TO_INCLUDE
|
|
196
|
-
},
|
|
197
|
-
serviceSpecialRates: {
|
|
198
|
-
include: SERVICE_SPECIALRATES_DATA_TO_INCLUDE
|
|
199
|
-
},
|
|
200
|
-
addons: true,
|
|
201
|
-
packages: {
|
|
202
|
-
include: SERVICE_PACKAGE_DATA_TO_INCLUDE
|
|
203
|
-
},
|
|
204
|
-
} satisfies Prisma.ServiceRatesAssociationInclude;
|
|
205
|
-
|
|
206
208
|
export interface BashNotificationExt extends BashNotification {
|
|
207
209
|
creator?: PublicUser;
|
|
208
210
|
bashEvent?: BashEvent;
|
|
@@ -469,6 +471,8 @@ export interface UserExt extends User {
|
|
|
469
471
|
reviews?: ReviewExt[] | null;
|
|
470
472
|
contacts?: Contact[] | null;
|
|
471
473
|
ticketsIOwn?: TicketExt[] | null;
|
|
474
|
+
ownedServices: ServiceExt[];
|
|
475
|
+
createdServices: ServiceExt[];
|
|
472
476
|
}
|
|
473
477
|
|
|
474
478
|
export const USER_DATA_SELECT_REVIEWS_COMMENTS = {
|
|
@@ -167,6 +167,12 @@ export function formatDateTimeToTimeString(date: Date | string | undefined | nul
|
|
|
167
167
|
return result;
|
|
168
168
|
}
|
|
169
169
|
|
|
170
|
+
export function formatDateTimeToTimeString24hr(date: Date | string | undefined | null): string {
|
|
171
|
+
date = new Date(date ?? Date.now());
|
|
172
|
+
const result = dayjs(date).format("h:mm");
|
|
173
|
+
return result;
|
|
174
|
+
}
|
|
175
|
+
|
|
170
176
|
export function parseTimeString(timeStr: string): ITime | null {
|
|
171
177
|
const match = timeStr.match(PARSE_TIME_REG);
|
|
172
178
|
|