feat: Add slotFormat query parameter to slots API V2 endpoint to return start and end time of a slot (#17873)

* feat: Add formatAsStartAndEndTime query parameter to slots API V2 endpoint to return start and end time of a slot

* Update apps/api/v2/src/modules/slots/controllers/slots.controller.ts

Co-authored-by: Praash <99237795+Praashh@users.noreply.github.com>

* Fix duration was allowed to be any number

* Refactor code

* Show slotFormat property as optional in swagger doc

---------

Co-authored-by: Praash <99237795+Praashh@users.noreply.github.com>
This commit is contained in:
Anwar Sadath
2024-12-05 19:12:17 +05:30
committed by GitHub
co-authored by Praash
parent 3290ae526a
commit ae4474cd42
8 changed files with 221 additions and 31 deletions
+39 -11
View File
@@ -4787,6 +4787,17 @@
"schema": {
"type": "number"
}
},
{
"name": "slotFormat",
"required": false,
"in": "query",
"description": "Format of slot times in response. Use 'range' to get start and end times.",
"example": "range",
"schema": {
"enum": ["range", "time"],
"type": "string"
}
}
],
"responses": {
@@ -4810,13 +4821,31 @@
"type": "array",
"items": {
"type": "object",
"properties": {
"time": {
"type": "string",
"format": "date-time",
"example": "2024-09-25T08:00:00.000Z"
"oneOf": [
{
"properties": {
"time": {
"type": "string",
"format": "date-time",
"example": "2024-09-25T08:00:00.000Z"
}
}
},
{
"properties": {
"startTime": {
"type": "string",
"format": "date-time",
"example": "2024-09-25T08:00:00.000Z"
},
"endTime": {
"type": "string",
"format": "date-time",
"example": "2024-09-25T08:30:00.000Z"
}
}
}
}
]
}
}
}
@@ -4837,13 +4866,12 @@
],
"2024-09-26": [
{
"time": "2024-09-26T08:00:00.000Z"
"startTime": "2024-09-26T08:00:00.000Z",
"endTime": "2024-09-26T08:30:00.000Z"
},
{
"time": "2024-09-26T08:15:00.000Z"
},
{
"time": "2024-09-26T08:30:00.000Z"
"startTime": "2024-09-26T08:15:00.000Z",
"endTime": "2024-09-26T08:45:00.000Z"
}
]
}