chore: update dtos for v2 calendars endpoint (#15904)

* init calendars input

* update request body input type

* fix incorrect naming

* update imprts

* fixup! update imprts

* fixup! fixup! update imprts

---------

Co-authored-by: Morgan Vernay <morgan@cal.com>
This commit is contained in:
Rajiv Sahal
2024-07-25 08:49:18 +00:00
committed by GitHub
co-authored by Morgan Vernay
parent bd73eba528
commit a997edd8db
3 changed files with 263 additions and 208 deletions
@@ -1,4 +1,5 @@
import { CalendarsRepository } from "@/ee/calendars/calendars.repository";
import { DeleteCalendarCredentialsInputBodyDto } from "@/ee/calendars/input/delete-calendar-credentials.input";
import { GetBusyTimesOutput } from "@/ee/calendars/outputs/busy-times.output";
import { ConnectedCalendarsOutput } from "@/ee/calendars/outputs/connected-calendars.output";
import {
@@ -196,7 +197,7 @@ export class CalendarsController {
@HttpCode(HttpStatus.OK)
async deleteCalendarCredentials(
@Param("calendar") calendar: string,
@Body() body: { id: number },
@Body() body: DeleteCalendarCredentialsInputBodyDto,
@GetUser() user: UserWithProfile
): Promise<DeletedCalendarCredentialsOutputResponseDto> {
const { id: credentialId } = body;
@@ -0,0 +1,15 @@
import { ApiProperty } from "@nestjs/swagger";
import { Expose } from "class-transformer";
import { IsInt } from "class-validator";
export class DeleteCalendarCredentialsInputBodyDto {
@IsInt()
@Expose()
@ApiProperty({
example: 10,
description: "Credential ID of the calendar to delete, as returned by the /calendars endpoint",
type: "integer",
required: true,
})
readonly id!: number;
}
+246 -207
View File
@@ -741,6 +741,81 @@
]
}
},
"/v2/selected-calendars": {
"post": {
"operationId": "SelectedCalendarsController_addSelectedCalendar",
"parameters": [],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SelectedCalendarsInputDto"
}
}
}
},
"responses": {
"201": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SelectedCalendarOutputResponseDto"
}
}
}
}
},
"tags": [
"Selected-Calendars"
]
},
"delete": {
"operationId": "SelectedCalendarsController_removeSelectedCalendar",
"parameters": [
{
"name": "integration",
"required": true,
"in": "query",
"schema": {
"type": "string"
}
},
{
"name": "externalId",
"required": true,
"in": "query",
"schema": {
"type": "string"
}
},
{
"name": "credentialId",
"required": true,
"in": "query",
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/SelectedCalendarOutputResponseDto"
}
}
}
}
},
"tags": [
"Selected-Calendars"
]
}
},
"/v2/event-types/{username}/{eventSlug}/public": {
"get": {
"operationId": "EventTypesController_2024_04_15_getPublicEventType",
@@ -1085,16 +1160,6 @@
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateScheduleInput_2024_06_11"
}
}
}
},
"responses": {
"201": {
"description": "",
@@ -1197,16 +1262,6 @@
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UpdateScheduleInput_2024_06_11"
}
}
}
},
"responses": {
"200": {
"description": "",
@@ -2246,16 +2301,6 @@
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UpdateScheduleInput_2024_04_15"
}
}
}
},
"responses": {
"200": {
"description": "",
@@ -2672,6 +2717,46 @@
]
}
},
"/v2/calendars/{calendar}/disconnect": {
"post": {
"operationId": "CalendarsController_deleteCalendarCredentials",
"parameters": [
{
"name": "calendar",
"required": true,
"in": "path",
"schema": {
"type": "string"
}
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/DeleteCalendarCredentialsInputBodyDto"
}
}
}
},
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/DeletedCalendarCredentialsOutputResponseDto"
}
}
}
}
},
"tags": [
"Calendars"
]
}
},
"/v2/bookings": {
"get": {
"operationId": "BookingsController_getBookings",
@@ -3880,6 +3965,69 @@
"data"
]
},
"SelectedCalendarsInputDto": {
"type": "object",
"properties": {
"integration": {
"type": "string"
},
"externalId": {
"type": "string"
},
"credentialId": {
"type": "number"
}
},
"required": [
"integration",
"externalId",
"credentialId"
]
},
"SelectedCalendarOutputDto": {
"type": "object",
"properties": {
"userId": {
"type": "number"
},
"integration": {
"type": "string"
},
"externalId": {
"type": "string"
},
"credentialId": {
"type": "number",
"nullable": true
}
},
"required": [
"userId",
"integration",
"externalId",
"credentialId"
]
},
"SelectedCalendarOutputResponseDto": {
"type": "object",
"properties": {
"status": {
"type": "string",
"example": "success",
"enum": [
"success",
"error"
]
},
"data": {
"$ref": "#/components/schemas/SelectedCalendarOutputDto"
}
},
"required": [
"status",
"data"
]
},
"EventTypeLocation_2024_04_15": {
"type": "object",
"properties": {
@@ -5181,57 +5329,6 @@
"data"
]
},
"CreateScheduleInput_2024_06_11": {
"type": "object",
"properties": {
"name": {
"type": "string",
"example": "One-on-one coaching"
},
"timeZone": {
"type": "string",
"example": "Europe/Rome"
},
"availability": {
"example": [
{
"days": [
"Monday",
"Tuesday"
],
"startTime": "09:00",
"endTime": "10:00"
}
],
"type": "array",
"items": {
"$ref": "#/components/schemas/ScheduleAvailabilityInput_2024_06_11"
}
},
"isDefault": {
"type": "boolean",
"example": true
},
"overrides": {
"example": [
{
"date": "2024-05-20",
"startTime": "12:00",
"endTime": "14:00"
}
],
"type": "array",
"items": {
"$ref": "#/components/schemas/ScheduleOverrideInput_2024_06_11"
}
}
},
"required": [
"name",
"timeZone",
"isDefault"
]
},
"CreateScheduleOutput_2024_06_11": {
"type": "object",
"properties": {
@@ -5280,52 +5377,6 @@
"data"
]
},
"UpdateScheduleInput_2024_06_11": {
"type": "object",
"properties": {
"name": {
"type": "string",
"example": "One-on-one coaching"
},
"timeZone": {
"type": "string",
"example": "Europe/Rome"
},
"availability": {
"example": [
{
"days": [
"Monday",
"Tuesday"
],
"startTime": "09:00",
"endTime": "10:00"
}
],
"type": "array",
"items": {
"$ref": "#/components/schemas/ScheduleAvailabilityInput_2024_06_11"
}
},
"isDefault": {
"type": "boolean",
"example": true
},
"overrides": {
"example": [
{
"date": "2024-05-20",
"startTime": "12:00",
"endTime": "14:00"
}
],
"type": "array",
"items": {
"$ref": "#/components/schemas/ScheduleOverrideInput_2024_06_11"
}
}
}
},
"UpdateScheduleOutput_2024_06_11": {
"type": "object",
"properties": {
@@ -6416,26 +6467,6 @@
"userId"
]
},
"GetDefaultScheduleOutput_2024_06_11": {
"type": "object",
"properties": {
"status": {
"type": "string",
"example": "success",
"enum": [
"success",
"error"
]
},
"data": {
"$ref": "#/components/schemas/ScheduleOutput_2024_06_11"
}
},
"required": [
"status",
"data"
]
},
"CreateAvailabilityInput_2024_04_15": {
"type": "object",
"properties": {
@@ -6733,66 +6764,6 @@
"data"
]
},
"UpdateScheduleInput_2024_04_15": {
"type": "object",
"properties": {
"timeZone": {
"type": "string"
},
"name": {
"type": "string"
},
"isDefault": {
"type": "boolean"
},
"schedule": {
"example": [
[],
[
{
"start": "2022-01-01T00:00:00.000Z",
"end": "2022-01-02T00:00:00.000Z"
}
],
[],
[],
[],
[],
[]
],
"items": {
"type": "array"
},
"type": "array"
},
"dateOverrides": {
"example": [
[],
[
{
"start": "2022-01-01T00:00:00.000Z",
"end": "2022-01-02T00:00:00.000Z"
}
],
[],
[],
[],
[],
[]
],
"items": {
"type": "array"
},
"type": "array"
}
},
"required": [
"timeZone",
"name",
"isDefault",
"schedule"
]
},
"EventTypeModel_2024_04_15": {
"type": "object",
"properties": {
@@ -7422,6 +7393,74 @@
"data"
]
},
"DeleteCalendarCredentialsInputBodyDto": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"example": 10,
"description": "Credential ID of the calendar to delete, as returned by the /calendars endpoint"
}
},
"required": [
"id"
]
},
"DeletedCalendarCredentialsOutputDto": {
"type": "object",
"properties": {
"id": {
"type": "number"
},
"type": {
"type": "string"
},
"userId": {
"type": "number",
"nullable": true
},
"teamId": {
"type": "number",
"nullable": true
},
"appId": {
"type": "string",
"nullable": true
},
"invalid": {
"type": "boolean",
"nullable": true
}
},
"required": [
"id",
"type",
"userId",
"teamId",
"appId",
"invalid"
]
},
"DeletedCalendarCredentialsOutputResponseDto": {
"type": "object",
"properties": {
"status": {
"type": "string",
"example": "success",
"enum": [
"success",
"error"
]
},
"data": {
"$ref": "#/components/schemas/DeletedCalendarCredentialsOutputDto"
}
},
"required": [
"status",
"data"
]
},
"Attendee": {
"type": "object",
"properties": {