fix: v2 create schedule with availabilities (#14551)

* fix: v2 schedule with availabilities creation

* driveby: remove permissions from public event-types endpoint
This commit is contained in:
Lauris Skraucis authored and GitHub committed 2024-04-12 15:49:47 +00:00
1 parent ac858c9bee
commit 5e98cca062
2 files changed
+8 -4

No files matched your search

@@ -91,7 +91,6 @@ export class EventTypesController {
}
@Get("/:username/public")
@Permissions([EVENT_TYPE_READ])
async getPublicEventTypes(@Param("username") username: string): Promise<GetEventTypesPublicOutput> {
const eventTypes = await this.eventTypesService.getEventTypesPublicByUsername(username);
@@ -19,12 +19,17 @@ export class CreateAvailabilityInput {
}
function transformStringToDate(value: string, key: string): Date {
const parts = value.split(":");
// note(Lauris): incoming value is ISO8061 e.g. 2025-0412T13:17:56.324Z
const dateTimeParts = value.split("T");
const timePart = dateTimeParts[1].split(".")[0]; // Removes milliseconds
const parts = timePart.split(":");
if (parts.length !== 3) {
throw new BadRequestException(`Invalid ${key} format. Expected format: HH:MM:SS. Received ${value}`);
throw new BadRequestException(
`Invalid time format. Expected format(ISO8061): 2025-0412T13:17:56.324Z. Received: ${value}`
);
}
const [hours, minutes, seconds] = parts.map(Number);
if (hours < 0 || hours > 23) {