refactor: v2 calendars busy-times (#18244)

* refactor: make dateFrom and dateTo required

* refactor: make dateFrom and dateTo required

* refactor: useCalendarsBusyTimes enabled only if dateFrom & dateTo passed
This commit is contained in:
Lauris Skraucis authored and GitHub committed 2024-12-18 13:36:26 +01:00
1 parent 8bf46ab8b6
commit ad5d92dff0
6 files changed
+57 -42

No files matched your search

@@ -86,18 +86,16 @@ export class CalendarsController {
@UseGuards(ApiAuthGuard)
@Get("/busy-times")
@ApiOperation({ summary: "Get busy times" })
@ApiOperation({
summary: "Get busy times",
description:
"Get busy times from a calendar. Example request URL is `https://api.cal.com/v2/calendars/busy-times?loggedInUsersTz=Europe%2FMadrid&dateFrom=2024-12-18&dateTo=2024-12-18&calendarsToLoad[0][credentialId]=135&calendarsToLoad[0][externalId]=skrauciz%40gmail.com`",
})
async getBusyTimes(
@Query() queryParams: CalendarBusyTimesInput,
@GetUser() user: UserWithProfile
): Promise<GetBusyTimesOutput> {
const { loggedInUsersTz, dateFrom, dateTo, calendarsToLoad } = queryParams;
if (!dateFrom || !dateTo) {
return {
status: SUCCESS_STATUS,
data: [],
};
}
const busyTimes = await this.calendarsService.getBusyTimes(
calendarsToLoad,
+21
View File
@@ -3592,6 +3592,7 @@
"get": {
"operationId": "CalendarsController_getBusyTimes",
"summary": "Get busy times",
"description": "Get busy times from a calendar. Example request URL is `https://api.cal.com/v2/calendars/busy-times?loggedInUsersTz=Europe%2FMadrid&dateFrom=2024-12-18&dateTo=2024-12-18&calendarsToLoad[0][credentialId]=135&calendarsToLoad[0][externalId]=skrauciz%40gmail.com`",
"parameters": [
{
"name": "loggedInUsersTz",
@@ -3603,6 +3604,26 @@
"type": "string"
}
},
{
"name": "dateFrom",
"required": false,
"in": "query",
"description": "The starting date for the busy times query",
"example": "2023-10-01",
"schema": {
"type": "string"
}
},
{
"name": "dateTo",
"required": false,
"in": "query",
"description": "The ending date for the busy times query",
"example": "2023-10-31",
"schema": {
"type": "string"
}
},
{
"name": "credentialId",
"in": "query",