Skip to content

Scheduling infrastructure for absolutely everyone.

Adds swagger for schedules (#247)

Syed Ali Shahbaz8fc4eedf5f8b
diff --git a/pages/api/schedules/[id]/_delete.ts b/pages/api/schedules/[id]/_delete.ts
index 502ab7b0293..e48c76c4697 100644
--- a/pages/api/schedules/[id]/_delete.ts
+++ b/pages/api/schedules/[id]/_delete.ts
@@ -17,6 +17,12 @@ import { schemaQueryIdParseInt } from "~/lib/validations/shared/queryIdTransform
* type: integer
* required: true
* description: ID of the schedule to delete
+ * - in: query
+ * name: apiKey
+ * schema:
+ * type: string
+ * required: true
+ * description: Your API Key
* tags:
* - schedules
* responses:
diff --git a/pages/api/schedules/[id]/_get.ts b/pages/api/schedules/[id]/_get.ts
index 568cedcf578..27502833fd7 100644
--- a/pages/api/schedules/[id]/_get.ts
+++ b/pages/api/schedules/[id]/_get.ts
@@ -18,6 +18,12 @@ import { schemaQueryIdParseInt } from "~/lib/validations/shared/queryIdTransform
* type: integer
* required: true
* description: ID of the schedule to get
+ * - in: query
+ * name: apiKey
+ * schema:
+ * type: string
+ * required: true
+ * description: Your API Key
* tags:
* - schedules
* responses:
diff --git a/pages/api/schedules/[id]/_patch.ts b/pages/api/schedules/[id]/_patch.ts
index e121eafa75e..85c67e91c03 100644
--- a/pages/api/schedules/[id]/_patch.ts
+++ b/pages/api/schedules/[id]/_patch.ts
@@ -20,6 +20,26 @@ import { schemaQueryIdParseInt } from "~/lib/validations/shared/queryIdTransform
* type: integer
* required: true
* description: ID of the schedule to edit
+ * - in: query
+ * name: apiKey
+ * schema:
+ * type: string
+ * required: true
+ * description: Your API Key
+ * requestBody:
+ * description: Create a new schedule
+ * required: true
+ * content:
+ * application/json:
+ * schema:
+ * type: object
+ * properties:
+ * name:
+ * type: string
+ * description: Name of the schedule
+ * timezone:
+ * type: string
+ * description: The timezone for this schedule
* tags:
* - schedules
* responses:
diff --git a/pages/api/schedules/_get.ts b/pages/api/schedules/_get.ts
index d6ca98abd6c..47907808358 100644
--- a/pages/api/schedules/_get.ts
+++ b/pages/api/schedules/_get.ts
@@ -18,6 +18,13 @@ export const schemaUserIds = z
* get:
* operationId: listSchedules
* summary: Find all schedules
+ * parameters:
+ * - in: query
+ * name: apiKey
+ * schema:
+ * type: string
+ * required: true
+ * description: Your API Key
* tags:
* - schedules
* responses:
diff --git a/pages/api/schedules/_post.ts b/pages/api/schedules/_post.ts
index 885b3cfa88f..892d5c0cef2 100644
--- a/pages/api/schedules/_post.ts
+++ b/pages/api/schedules/_post.ts
@@ -13,6 +13,30 @@ import { schemaCreateScheduleBodyParams, schemaSchedulePublic } from "~/lib/vali
* post:
* operationId: addSchedule
* summary: Creates a new schedule
+ * parameters:
+ * - in: query
+ * name: apiKey
+ * schema:
+ * type: string
+ * required: true
+ * description: Your API Key
+ * requestBody:
+ * description: Create a new schedule
+ * required: true
+ * content:
+ * application/json:
+ * schema:
+ * type: object
+ * required:
+ * - name
+ * - timezone
+ * properties:
+ * name:
+ * type: string
+ * description: Name of the schedule
+ * timezone:
+ * type: string
+ * description: The timezone for this schedule
* tags:
* - schedules
* responses:
@@ -23,6 +47,12 @@ import { schemaCreateScheduleBodyParams, schemaSchedulePublic } from "~/lib/vali
* 401:
* description: Authorization information is missing or invalid.
*/
+
+
+eventType EventType[]
+name String
+timeZone String?
+availability Availability[]
async function postHandler(req: NextApiRequest) {
const { userId, isAdmin, prisma } = req;
const body = schemaCreateScheduleBodyParams.parse(req.body);