Swagger/booking req resp body (#256)
This commit is contained in:
@@ -32,7 +32,29 @@ import { schemaQueryIdParseInt } from "~/lib/validations/shared/queryIdTransform
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/Booking"
|
||||
* $ref: "#/components/schemas/ArrayOfBookings"
|
||||
* examples:
|
||||
* bookings:
|
||||
* value: [
|
||||
* {
|
||||
* "id": 1,
|
||||
* "description": "Meeting with John",
|
||||
* "eventTypeId": 2,
|
||||
* "uid": "a1b2c3d4-e5f6-7890-g1h2-i3j4k5l6m7n8",
|
||||
* "title": "Business Meeting",
|
||||
* "startTime": "2023-04-20T10:00:00.000Z",
|
||||
* "endTime": "2023-04-20T11:00:00.000Z",
|
||||
* "timeZone": "Europe/London",
|
||||
* "attendees": [
|
||||
* {
|
||||
* "email": "example@cal.com",
|
||||
* "name": "John Doe",
|
||||
* "timeZone": "Europe/London",
|
||||
* "locale": "en"
|
||||
* }
|
||||
* ]
|
||||
* }
|
||||
* ]
|
||||
* 401:
|
||||
* description: Authorization information is missing or invalid.
|
||||
* 404:
|
||||
|
||||
@@ -35,6 +35,15 @@ import { schemaQueryIdParseInt } from "~/lib/validations/shared/queryIdTransform
|
||||
* status:
|
||||
* type: string
|
||||
* description: 'Acceptable values one of ["ACCEPTED", "PENDING", "CANCELLED", "REJECTED"]'
|
||||
* examples:
|
||||
* editBooking:
|
||||
* value:
|
||||
* {
|
||||
* "title": "Debugging between Syed Ali Shahbaz and Hello Hello",
|
||||
* "start": "2023-05-24T13:00:00.000Z",
|
||||
* "end": "2023-05-24T13:30:00.000Z",
|
||||
* "status": "CANCELLED"
|
||||
* }
|
||||
*
|
||||
* parameters:
|
||||
* - in: query
|
||||
@@ -52,8 +61,27 @@ import { schemaQueryIdParseInt } from "~/lib/validations/shared/queryIdTransform
|
||||
* tags:
|
||||
* - bookings
|
||||
* responses:
|
||||
* 201:
|
||||
* 200:
|
||||
* description: OK, booking edited successfully
|
||||
* content:
|
||||
* application/json:
|
||||
* examples:
|
||||
* bookings:
|
||||
* value:
|
||||
* {
|
||||
* "booking": {
|
||||
* "id": 11223344,
|
||||
* "userId": 182,
|
||||
* "description": null,
|
||||
* "eventTypeId": 2323232,
|
||||
* "uid": "stoSJtnh83PEL4rZmqdHe2",
|
||||
* "title": "Debugging between Syed Ali Shahbaz and Hello Hello",
|
||||
* "startTime": "2023-05-24T13:00:00.000Z",
|
||||
* "endTime": "2023-05-24T13:30:00.000Z",
|
||||
* "metadata": {},
|
||||
* "status": "CANCELLED"
|
||||
* }
|
||||
* }
|
||||
* 400:
|
||||
* description: Bad request. Booking body is invalid.
|
||||
* 401:
|
||||
|
||||
@@ -19,15 +19,18 @@ import { schemaQuerySingleOrMultipleUserIds } from "~/lib/validations/shared/que
|
||||
* schema:
|
||||
* type: string
|
||||
* description: Your API key
|
||||
* example: 123456789abcdefgh
|
||||
* - in: query
|
||||
* name: userId
|
||||
* required: false
|
||||
* schema:
|
||||
* oneOf:
|
||||
* - type: integer
|
||||
* example: 1
|
||||
* - type: array
|
||||
* items:
|
||||
* type: integer
|
||||
* example: [2, 3, 4]
|
||||
* operationId: listBookings
|
||||
* tags:
|
||||
* - bookings
|
||||
@@ -38,11 +41,34 @@ import { schemaQuerySingleOrMultipleUserIds } from "~/lib/validations/shared/que
|
||||
* application/json:
|
||||
* schema:
|
||||
* $ref: "#/components/schemas/ArrayOfBookings"
|
||||
* examples:
|
||||
* bookings:
|
||||
* value: [
|
||||
* {
|
||||
* "id": 1,
|
||||
* "description": "Meeting with John",
|
||||
* "eventTypeId": 2,
|
||||
* "uid": "a1b2c3d4-e5f6-7890-g1h2-i3j4k5l6m7n8",
|
||||
* "title": "Business Meeting",
|
||||
* "startTime": "2023-04-20T10:00:00.000Z",
|
||||
* "endTime": "2023-04-20T11:00:00.000Z",
|
||||
* "timeZone": "Europe/London",
|
||||
* "attendees": [
|
||||
* {
|
||||
* "email": "example@cal.com",
|
||||
* "name": "John Doe",
|
||||
* "timeZone": "Europe/London",
|
||||
* "locale": "en"
|
||||
* }
|
||||
* ]
|
||||
* }
|
||||
* ]
|
||||
* 401:
|
||||
* description: Authorization information is missing or invalid.
|
||||
* description: Authorization information is missing or invalid.
|
||||
* 404:
|
||||
* description: No bookings were found
|
||||
*/
|
||||
|
||||
async function handler(req: NextApiRequest) {
|
||||
const { userId, isAdmin, prisma } = req;
|
||||
const args: Prisma.BookingFindManyArgs = {};
|
||||
|
||||
+71
-16
@@ -90,27 +90,82 @@ import { defaultResponder } from "@calcom/lib/server";
|
||||
* smsReminderNumber:
|
||||
* type: number
|
||||
* description: 'SMS reminder number'
|
||||
* examples:
|
||||
* New Booking example:
|
||||
* value:
|
||||
* {
|
||||
* "eventTypeId": 1,
|
||||
* "start": "2023-05-01T14:00:00Z",
|
||||
* "end": "2023-05-01T15:00:00Z",
|
||||
* "name": "John Doe",
|
||||
* "email": "john.doe@example.com",
|
||||
* "timeZone": "America/New_York",
|
||||
* "language": "en-US",
|
||||
* "metadata": {},
|
||||
* "customInputs": [],
|
||||
* "location": "Conference Room A"
|
||||
* }
|
||||
* examples:
|
||||
* New Booking example:
|
||||
* value:
|
||||
* {
|
||||
* "eventTypeId": 2323232,
|
||||
* "start": "2023-05-24T13:00:00.000Z",
|
||||
* "end": "2023-05-24T13:30:00.000Z",
|
||||
* "name": "Hello Hello",
|
||||
* "email": "hello@gmail.com",
|
||||
* "timeZone": "Europe/London",
|
||||
* "language": "en",
|
||||
* "metadata": {},
|
||||
* "customInputs": [],
|
||||
* "location": "Calcom HQ",
|
||||
* "title": "Debugging between Syed Ali Shahbaz and Hello Hello",
|
||||
* "description": null,
|
||||
* "status": "PENDING",
|
||||
* "smsReminderNumber": null
|
||||
* }
|
||||
*
|
||||
* tags:
|
||||
* - bookings
|
||||
* responses:
|
||||
* 201:
|
||||
* 200:
|
||||
* description: Booking(s) created successfully.
|
||||
* content:
|
||||
* application/json:
|
||||
* examples:
|
||||
* bookings:
|
||||
* value:
|
||||
* {
|
||||
* "id": 11223344,
|
||||
* "uid": "5yUjmAYTDF6MXo98re8SkX",
|
||||
* "userId": 123,
|
||||
* "eventTypeId": 2323232,
|
||||
* "title": "Debugging between Syed Ali Shahbaz and Hello Hello",
|
||||
* "description": null,
|
||||
* "customInputs": {},
|
||||
* "responses": null,
|
||||
* "startTime": "2023-05-24T13:00:00.000Z",
|
||||
* "endTime": "2023-05-24T13:30:00.000Z",
|
||||
* "location": "Calcom HQ",
|
||||
* "createdAt": "2023-04-19T10:17:58.580Z",
|
||||
* "updatedAt": null,
|
||||
* "status": "PENDING",
|
||||
* "paid": false,
|
||||
* "destinationCalendarId": 2180,
|
||||
* "cancellationReason": null,
|
||||
* "rejectionReason": null,
|
||||
* "dynamicEventSlugRef": null,
|
||||
* "dynamicGroupSlugRef": null,
|
||||
* "rescheduled": null,
|
||||
* "fromReschedule": null,
|
||||
* "recurringEventId": null,
|
||||
* "smsReminderNumber": null,
|
||||
* "scheduledJobs": [],
|
||||
* "metadata": {},
|
||||
* "isRecorded": false,
|
||||
* "user": {
|
||||
* "email": "test@cal.com",
|
||||
* "name": "Syed Ali Shahbaz",
|
||||
* "timeZone": "Asia/Calcutta"
|
||||
* },
|
||||
* "attendees": [
|
||||
* {
|
||||
* "id": 12345,
|
||||
* "email": "hello@gmail.com",
|
||||
* "name": "Hello Hello",
|
||||
* "timeZone": "Europe/London",
|
||||
* "locale": "en",
|
||||
* "bookingId": 11223344
|
||||
* }
|
||||
* ],
|
||||
* "payment": [],
|
||||
* "references": []
|
||||
* }
|
||||
* 400:
|
||||
* description: |
|
||||
* Bad request
|
||||
|
||||
Reference in New Issue
Block a user