Skip to content

Scheduling infrastructure for absolutely everyone.

Update availabilities _post swagger def (#210)

Syed Ali Shahbaz4080e5bc5ed5
diff --git a/pages/api/availabilities/[id]/_delete.ts b/pages/api/availabilities/[id]/_delete.ts
index a298642d6f7..df90d2bc555 100644
--- a/pages/api/availabilities/[id]/_delete.ts
+++ b/pages/api/availabilities/[id]/_delete.ts
@@ -17,6 +17,12 @@ import { schemaQueryIdParseInt } from "@lib/validations/shared/queryIdTransformP
* type: integer
* required: true
* description: ID of the availability to delete
+ * - in: query
+ * name: apiKey
+ * required: true
+ * schema:
+ * type: integer
+ * description: Your API key
* tags:
* - availabilities
* externalDocs:
diff --git a/pages/api/availabilities/[id]/_get.ts b/pages/api/availabilities/[id]/_get.ts
index 3ea8064e057..f4fbe65f2af 100644
--- a/pages/api/availabilities/[id]/_get.ts
+++ b/pages/api/availabilities/[id]/_get.ts
@@ -18,6 +18,12 @@ import { schemaQueryIdParseInt } from "@lib/validations/shared/queryIdTransformP
* type: integer
* required: true
* description: ID of the availability to get
+ * - in: query
+ * name: apiKey
+ * required: true
+ * schema:
+ * type: integer
+ * description: Your API key
* tags:
* - availabilities
* externalDocs:
@@ -26,7 +32,9 @@ import { schemaQueryIdParseInt } from "@lib/validations/shared/queryIdTransformP
* 200:
* description: OK
* 401:
- * description: Unauthorized
+ * description: Authorization information is missing or invalid
+ * 404:
+ * description: Availability not found
*/
export async function getHandler(req: NextApiRequest) {
const { prisma, query } = req;
diff --git a/pages/api/availabilities/[id]/_patch.ts b/pages/api/availabilities/[id]/_patch.ts
index 9e7b0b5ebb8..fdeb6937997 100644
--- a/pages/api/availabilities/[id]/_patch.ts
+++ b/pages/api/availabilities/[id]/_patch.ts
@@ -14,6 +14,19 @@ import { schemaQueryIdParseInt } from "@lib/validations/shared/queryIdTransformP
* patch:
* operationId: editAvailabilityById
* summary: Edit an existing availability
+ * parameters:
+ * - in: query
+ * name: apiKey
+ * required: true
+ * description: Your API key
+ * schema:
+ * type: integer
+ * - in: path
+ * name: id
+ * required: true
+ * schema:
+ * type: integer
+ * description: ID of the availability to edit
* requestBody:
* description: Edit an existing availability related to one of your bookings
* required: true
@@ -24,20 +37,28 @@ import { schemaQueryIdParseInt } from "@lib/validations/shared/queryIdTransformP
* properties:
* days:
* type: array
- * example: [email protected]
+ * description: Array of integers depicting weekdays
+ * items:
+ * type: integer
+ * enum: [0, 1, 2, 3, 4, 5]
+ * scheduleId:
+ * type: integer
+ * description: ID of schedule this availability is associated with
* startTime:
* type: string
- * example: 1970-01-01T17:00:00.000Z
+ * description: Start time of the availability
* endTime:
* type: string
- * example: 1970-01-01T17:00:00.000Z
- * parameters:
- * - in: path
- * name: id
- * schema:
- * type: integer
- * required: true
- * description: ID of the availability to edit
+ * description: End time of the availability
+ * examples:
+ * availability:
+ * summary: An example of availability
+ * value:
+ * scheduleId: 123
+ * days: [1,2,3,5]
+ * startTime: 1970-01-01T17:00:00.000Z
+ * endTime: 1970-01-01T17:00:00.000Z
+ *
* tags:
* - availabilities
* externalDocs:
diff --git a/pages/api/availabilities/_post.ts b/pages/api/availabilities/_post.ts
index aa4bac13fe2..6169fbcc247 100644
--- a/pages/api/availabilities/_post.ts
+++ b/pages/api/availabilities/_post.ts
@@ -14,6 +14,13 @@ import {
* post:
* operationId: addAvailability
* summary: Creates a new availability
+ * parameters:
+ * - in: query
+ * name: apiKey
+ * requiried: true
+ * description: Your API key
+ * schema:
+ * type: integer
* requestBody:
* description: Edit an existing availability related to one of your bookings
* required: true
@@ -28,13 +35,29 @@ import {
* properties:
* days:
* type: array
- * example: [email protected]
+ * description: Array of integers depicting weekdays
+ * items:
+ * type: integer
+ * enum: [0, 1, 2, 3, 4, 5]
+ * scheduleId:
+ * type: integer
+ * description: ID of schedule this availability is associated with
* startTime:
* type: string
- * example: 1970-01-01T17:00:00.000Z
+ * description: Start time of the availability
* endTime:
* type: string
- * example: 1970-01-01T17:00:00.000Z
+ * description: End time of the availability
+ * examples:
+ * availability:
+ * summary: An example of availability
+ * value:
+ * scheduleId: 123
+ * days: [1,2,3,5]
+ * startTime: 1970-01-01T17:00:00.000Z
+ * endTime: 1970-01-01T17:00:00.000Z
+ *
+ *
* tags:
* - availabilities
* externalDocs: