Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

add GET/PATCH/DELETE /api/v3/non_working_days/{date}

Christophe Bliardf065d80c4e11
diff --git a/docs/api/apiv3/components/schemas/non_working_day_model.yml b/docs/api/apiv3/components/schemas/non_working_day_model.yml
index 31c81037010..39b93b1a1f6 100644
--- a/docs/api/apiv3/components/schemas/non_working_day_model.yml
+++ b/docs/api/apiv3/components/schemas/non_working_day_model.yml
@@ -5,7 +5,6 @@ required:
- _type
- date
- name
- - _links
properties:
_type:
type: string
diff --git a/docs/api/apiv3/openapi-spec.yml b/docs/api/apiv3/openapi-spec.yml
index fe4ef9d5d29..e540305566a 100644
--- a/docs/api/apiv3/openapi-spec.yml
+++ b/docs/api/apiv3/openapi-spec.yml
@@ -429,13 +429,9 @@ paths:
"$ref": "./paths/work_schedule_week_day.yml"
"/api/v3/work_schedule/non_working_days":
"$ref": "./paths/work_schedule_non_working_days.yml"
- # TODO: get
- # TODO: patch
- # TODO: delete
"/api/v3/work_schedule/non_working_days/{date}":
"$ref": "./paths/work_schedule_non_working_day.yml"
# TODO: add some **Permission** in some description fields
- # TODO: populate **tags** section
components:
examples:
diff --git a/docs/api/apiv3/paths/work_schedule_non_working_day.yml b/docs/api/apiv3/paths/work_schedule_non_working_day.yml
index 575d30498ce..11fb13e5354 100644
--- a/docs/api/apiv3/paths/work_schedule_non_working_day.yml
+++ b/docs/api/apiv3/paths/work_schedule_non_working_day.yml
@@ -1,8 +1,13 @@
+# /api/v3/non_working_days/{date}
---
-# TODO: add missing description, missing tags, missing parameters, and missing response codes
get:
summary: View a non-working day
operationId: view_non_working_day
+ tags:
+ - Work Schedule
+ - Non working days
+ description: |-
+ Returns the non-working day information for a given date.
parameters:
- name: date
in: path
@@ -16,11 +21,36 @@ get:
responses:
'200':
description: OK
+ content:
+ application/hal+json:
+ schema:
+ $ref: '../components/schemas/non_working_day_model.yml'
+ '400':
+ description: Returned if the client sends invalid request parameters.
+ content:
+ application/hal+json:
+ schema:
+ $ref: '../components/schemas/error_response.yml'
+ '404':
+ description: Returned if the given date is not a non-working day.
+ content:
+ application/hal+json:
+ schema:
+ $ref: '../components/schemas/error_response.yml'
+ example:
+ _type: Error
+ errorIdentifier: urn:openproject-org:api:v3:errors:NotFound
+ message: The requested resource could not be found.
# TODO: add missing description, missing tags, missing parameters, and missing response codes
patch:
summary: Update a non-working day attributes
operationId: update_non_working_day
+ tags:
+ - Work Schedule
+ - Non working days
+ description: |-
+ Update the non-working day information for a given date.
parameters:
- name: date
in: path
@@ -31,14 +61,53 @@ patch:
type: string
format: date
example: '2022-05-06'
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: ../components/schemas/non_working_day_model.yml
+ example:
+ _type: NonWorkingDay
+ date: '2022-05-01'
+ name: 'Labour day'
+
responses:
'200':
description: OK
+ content:
+ application/hal+json:
+ schema:
+ $ref: '../components/schemas/non_working_day_model.yml'
+ '400':
+ description: Returned if the client sends invalid request parameters.
+ content:
+ application/hal+json:
+ schema:
+ $ref: '../components/schemas/error_response.yml'
+ '404':
+ description: Returned if the given date is not a non-working day.
+ content:
+ application/hal+json:
+ schema:
+ $ref: '../components/schemas/error_response.yml'
+ example:
+ _type: Error
+ errorIdentifier: urn:openproject-org:api:v3:errors:NotFound
+ message: The requested resource could not be found.
# TODO: add missing description, missing tags, missing parameters, and missing response codes
delete:
- summary: Remove a day from the non-working days
+ summary: Removes a day from the non-working days
operationId: delete_non_working_day
+ tags:
+ - Work Schedule
+ - Non working days
+ description: |-
+ Removes the day of the given day from the non-working days known.
+
+ Trying to remove a date which is not a non-working day, by calling the same
+ endpoint twice for example, will succeed in both cases and return a 204
+ status.
parameters:
- name: date
in: path
@@ -50,5 +119,15 @@ delete:
format: date
example: '2022-05-06'
responses:
- '200':
- description: OK
+ '204':
+ description: |-
+ No Content.
+
+ The operation succeeded.
+ '400':
+ description: |-
+ Returned if the client sends invalid request parameters.
+ content:
+ application/hal+json:
+ schema:
+ $ref: '../components/schemas/error_response.yml'
diff --git a/docs/api/apiv3/paths/work_schedule_non_working_days.yml b/docs/api/apiv3/paths/work_schedule_non_working_days.yml
index 5f6bdc454d8..d66820b8a60 100644
--- a/docs/api/apiv3/paths/work_schedule_non_working_days.yml
+++ b/docs/api/apiv3/paths/work_schedule_non_working_days.yml
@@ -40,7 +40,7 @@ get:
schema:
$ref: '../components/schemas/non_working_day_collection_model.yml'
'400':
- description: Returned if the client sends invalid request parameters
+ description: Returned if the client sends invalid request parameters.
content:
application/hal+json:
schema: