@bash-app/bash-common 30.17.0 → 30.19.0
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
package/prisma/schema.prisma
CHANGED
package/src/extendedSchemas.ts
CHANGED
|
@@ -137,6 +137,18 @@ export interface BashEventExt extends BashEvent {
|
|
|
137
137
|
// Do not include in fetch. Could be hundreds of these
|
|
138
138
|
invitations: Partial<InvitationExt>[];
|
|
139
139
|
coordinates?: Coordinates[];
|
|
140
|
+
venueServiceId?: string;
|
|
141
|
+
venueOwner?: {
|
|
142
|
+
id: string;
|
|
143
|
+
email: string;
|
|
144
|
+
givenName?: string;
|
|
145
|
+
familyName?: string;
|
|
146
|
+
};
|
|
147
|
+
sponsorships?: Array<{
|
|
148
|
+
sponsorId: string;
|
|
149
|
+
sponsorEmail: string;
|
|
150
|
+
name?: string;
|
|
151
|
+
}>;
|
|
140
152
|
}
|
|
141
153
|
|
|
142
154
|
export const TICKET_TIER_DATA_TO_INCLUDE = {
|
package/src/utils/luxonUtils.ts
CHANGED
|
@@ -12,9 +12,10 @@ const PARSE_TIME_REG = /^(\d{1,2}):(\d{2}) ?([APM]{0,2})$/i;
|
|
|
12
12
|
|
|
13
13
|
// export const LUXON_DATETIME_FORMAT_STANDARD = "MM/dd/yyyy - hh:mm a";
|
|
14
14
|
export const LUXON_DATETIME_FORMAT_STANDARD = "D t";
|
|
15
|
-
export const LUXON_DATETIME_FORMAT_ISO_LIKE = "
|
|
15
|
+
export const LUXON_DATETIME_FORMAT_ISO_LIKE = "D t"; //"D t";
|
|
16
16
|
// export const LUXON_DATE_FORMAT_STANDARD = "yyyy/MM/dd";
|
|
17
17
|
// export const LUXON_DATE_FORMAT_ISO = "yyyy/MM/dd";
|
|
18
|
+
export const LUXON_DATETIME_FORMAT_DATE = "D"; //"D t";
|
|
18
19
|
export const LUXON_TIME_FORMAT_AM_PM = "h:mm a";
|
|
19
20
|
|
|
20
21
|
export const MINUTES_PER_DAY = 1440;
|
|
@@ -199,6 +200,10 @@ export function dateTimeFormatTime(dateTime?: DateTime | null) {
|
|
|
199
200
|
return dateTime?.toFormat(LUXON_TIME_FORMAT_AM_PM) ?? "";
|
|
200
201
|
}
|
|
201
202
|
|
|
203
|
+
export function dateTimeFormatDate(dateTime?: DateTime | null) {
|
|
204
|
+
return dateTime?.toFormat(LUXON_DATETIME_FORMAT_DATE) ?? "";
|
|
205
|
+
}
|
|
206
|
+
|
|
202
207
|
export function dateTimeWithinRange(
|
|
203
208
|
dateTime: DateTime,
|
|
204
209
|
dateRange: LuxonDateRange
|
|
@@ -278,6 +283,21 @@ export function dateTimeFormatDateRange(
|
|
|
278
283
|
)}`;
|
|
279
284
|
}
|
|
280
285
|
|
|
286
|
+
export function dateTimeFormatDateRangeDate(
|
|
287
|
+
startDateTimeArg: DateTime | null,
|
|
288
|
+
endDateTimeArg: DateTime | null
|
|
289
|
+
): string {
|
|
290
|
+
if (startDateTimeArg?.day === endDateTimeArg?.day) {
|
|
291
|
+
return `${dateTimeFormatDate(startDateTimeArg)} to ${dateTimeFormatDate(
|
|
292
|
+
endDateTimeArg
|
|
293
|
+
)}`;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
return `${dateTimeFormatDate(startDateTimeArg)} to ${dateTimeFormatDate(
|
|
297
|
+
endDateTimeArg
|
|
298
|
+
)}`;
|
|
299
|
+
}
|
|
300
|
+
|
|
281
301
|
export interface DateTimeFormatDateRangeListResult {
|
|
282
302
|
start: string;
|
|
283
303
|
end: string;
|
|
@@ -9,3 +9,13 @@ export function isPositiveFloat(str: string): boolean {
|
|
|
9
9
|
export function isPrice(str: string): boolean {
|
|
10
10
|
return /^\d*\.?\d{0,2}$/.test(str);
|
|
11
11
|
}
|
|
12
|
+
|
|
13
|
+
export function isUrlInputtingProtocol(str: string): boolean {
|
|
14
|
+
return /^(?:(?:|h|ht|htt|http|https)|(?:http|https):(?:\/{0,2})?)$/.test(str);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function isUrl(str: string): boolean {
|
|
18
|
+
return /(?:^https?:\/\/[^\s\/$?#;&=@:]*$)|(?:^https?:\/{0,2}$)|(?:^[^\s\/$?#;&=@:]*$)/.test(
|
|
19
|
+
str
|
|
20
|
+
);
|
|
21
|
+
}
|
|
@@ -1,31 +1,25 @@
|
|
|
1
1
|
import {
|
|
2
|
-
Service,
|
|
3
2
|
ServiceRate,
|
|
4
3
|
ServiceRatePricingType,
|
|
5
4
|
ServiceRateType,
|
|
6
5
|
} from "@prisma/client";
|
|
6
|
+
import { DateTime } from "luxon";
|
|
7
7
|
import {
|
|
8
8
|
ServiceDailyRatesExt,
|
|
9
|
-
ServiceRateExt,
|
|
10
9
|
ServiceRatesAssociationExt,
|
|
11
10
|
ServiceSpecialRatesExt,
|
|
12
11
|
} from "../../extendedSchemas";
|
|
13
12
|
import {
|
|
14
13
|
LuxonDateRange,
|
|
15
|
-
dateTimeFromDate,
|
|
16
|
-
dateRangeWithinDateRange,
|
|
17
|
-
dateRangeDurationMatch,
|
|
18
|
-
dateTimeRangeToInterval,
|
|
19
14
|
dateRangeNormalizeToMWY,
|
|
15
|
+
dateTimeFromDate,
|
|
20
16
|
dateTimeRangeIntersection,
|
|
21
|
-
dateTimeRangeHours,
|
|
22
17
|
} from "../luxonUtils";
|
|
23
|
-
import {
|
|
18
|
+
import { ServiceBookingPriceBreakdownBaseT } from "./serviceBookingTypes";
|
|
24
19
|
import {
|
|
25
20
|
ServiceDailyRatesExtT,
|
|
26
21
|
ServiceSpecialRatesExtT,
|
|
27
22
|
} from "./serviceRateTypes";
|
|
28
|
-
import { ServiceBookingPriceBreakdownBaseT } from "./serviceBookingTypes";
|
|
29
23
|
|
|
30
24
|
export const SERVICE_DAILY_RATE_HOURS_MIN = 8;
|
|
31
25
|
|
|
@@ -302,23 +296,23 @@ export function serviceRatesAssociationGetBlockedDates(
|
|
|
302
296
|
|
|
303
297
|
export function serviceRatesAssociationGetSpecialRates(
|
|
304
298
|
serviceRatesAssociation: ServiceRatesAssociationExt | null | undefined,
|
|
305
|
-
timezone: string | undefined | null
|
|
299
|
+
timezone: string | undefined | null,
|
|
300
|
+
filterPastDates: boolean = false
|
|
306
301
|
) {
|
|
307
302
|
return (
|
|
308
303
|
serviceRatesAssociation?.serviceSpecialRates
|
|
309
304
|
?.filter((rate) => rate.isAvailable)
|
|
310
305
|
.map((rate) => {
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
}) ?? []
|
|
306
|
+
return serviceRateToLuxonRate(
|
|
307
|
+
rate,
|
|
308
|
+
timezone
|
|
309
|
+
) as ServiceSpecialRatesExtT;
|
|
310
|
+
})
|
|
311
|
+
.filter(
|
|
312
|
+
(rate: ServiceSpecialRatesExtT) =>
|
|
313
|
+
!filterPastDates ||
|
|
314
|
+
(rate.dateTimeRange.start >= DateTime.now() &&
|
|
315
|
+
rate.dateTimeRange.end >= DateTime.now())
|
|
316
|
+
) ?? []
|
|
323
317
|
);
|
|
324
318
|
}
|