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

specify /api/v3/days and /api/v3/days/{date} endpoints

Christophe Bliard314190da3221
diff --git a/docs/api/apiv3/components/schemas/day_collection_model.yml b/docs/api/apiv3/components/schemas/day_collection_model.yml
new file mode 100644
index 00000000000..889ebe7d42a
--- /dev/null
+++ b/docs/api/apiv3/components/schemas/day_collection_model.yml
@@ -0,0 +1,101 @@
+# Schema: DayCollectionModel
+---
+allOf:
+ - $ref: './collection_model.yml'
+ - type: object
+ required:
+ - _links
+ - _embedded
+ properties:
+ _links:
+ type: object
+ required:
+ - self
+ properties:
+ self:
+ allOf:
+ - $ref: './link.yml'
+ - description: |-
+ This days collection
+
+ **Resource**: DayCollectionModel
+ _embedded:
+ type: object
+ required:
+ - elements
+ properties:
+ elements:
+ type: array
+ description: |-
+ The array of days. Each day has a name and a working status
+ indicating if it is a working or a non-working day.
+ items:
+ $ref: './day_model.yml'
+
+example:
+ _type: Collection
+ total: 5
+ count: 5
+ _links:
+ self:
+ href: '/api/v3/days?filters=[{"interval":{"operator":"<>d","values":["2022-04-29","2022-05-03"]}}]'
+ _embedded:
+ elements:
+ - _type: Day
+ date: '2022-04-29'
+ name: Friday
+ working: true
+ _links:
+ self:
+ href: /api/v3/days/2022-04-29
+ weekday:
+ href: /api/v3/days/week/5
+ title: Friday
+ - _type: Day
+ date: '2022-04-30'
+ name: Saturday
+ working: false
+ _links:
+ self:
+ href: /api/v3/days/2022-04-30
+ nonWorkingReasons:
+ - href: /api/v3/days/week/6
+ title: Saturday
+ weekday:
+ href: /api/v3/days/week/6
+ title: Saturday
+ - _type: Day
+ date: '2022-05-01'
+ name: Sunday (Labour day)
+ working: false
+ _links:
+ self:
+ href: /api/v3/days/2022-05-01
+ nonWorkingReasons:
+ - href: /api/v3/days/week/7
+ title: Sunday
+ - href: /api/v3/days/non_working/2022-05-01
+ title: Labour day
+ weekday:
+ href: /api/v3/days/week/7
+ title: Sunday
+ - _type: Day
+ date: '2022-05-02'
+ name: Monday
+ working: true
+ _links:
+ self:
+ href: /api/v3/days/2022-05-02
+ weekday:
+ href: /api/v3/days/week/1
+ title: Monday
+ - _type: Day
+ date: '2022-05-03'
+ name: Tuesday
+ working: true
+ _links:
+ self:
+ href: /api/v3/days/2022-05-03
+ weekday:
+ href: /api/v3/days/week/2
+ title: Tuesday
diff --git a/docs/api/apiv3/components/schemas/day_model.yml b/docs/api/apiv3/components/schemas/day_model.yml
new file mode 100644
index 00000000000..0d35007b61e
--- /dev/null
+++ b/docs/api/apiv3/components/schemas/day_model.yml
@@ -0,0 +1,62 @@
+# Schema: DayModel
+---
+type: object
+required:
+ - _type
+ - date
+ - name
+ - working
+properties:
+ _type:
+ type: string
+ enum:
+ - Day
+ date:
+ type: string
+ format: date
+ description: |-
+ Date of the day.
+ name:
+ type: string
+ description: |-
+ Descriptive name for the day.
+ working:
+ type: boolean
+ description: |-
+ `true` for a working day, `false` otherwise.
+ _links:
+ type: object
+ required:
+ - self
+ properties:
+ self:
+ $ref: './link.yml'
+ nonWorkingReasons:
+ type: array
+ description: |-
+ A list of resources describing why this day is a non-working day.
+ Linked resources can be `NonWorkingDay` and `WeekDay` resources.
+ This property is absent for working days.
+ items:
+ $ref: './link.yml'
+ weekDay:
+ allOf:
+ - $ref: './link.yml'
+ - description: |-
+ The week day for this day.
+example:
+ _type: Day
+ date: '2022-12-25'
+ name: Sunday (Christmas)
+ working: false
+ _links:
+ self:
+ href: /api/v3/days/2022-12-25
+ nonWorkingReasons:
+ - href: /api/v3/days/week/7
+ title: Sunday
+ - href: /api/v3/days/non_working/2022-12-25
+ title: Christmas
+ weekday:
+ href: /api/v3/days/week/7
+ title: Sunday
diff --git a/docs/api/apiv3/components/schemas/non_working_day_collection_model.yml b/docs/api/apiv3/components/schemas/non_working_day_collection_model.yml
deleted file mode 100644
index 3445ccca5e6..00000000000
--- a/docs/api/apiv3/components/schemas/non_working_day_collection_model.yml
+++ /dev/null
@@ -1,86 +0,0 @@
-# Schema: NonWorkingDayCollectionModel
----
-allOf:
- - $ref: './collection_model.yml'
- - type: object
- required:
- - _links
- - _embedded
- properties:
- _links:
- type: object
- required:
- - self
- properties:
- self:
- allOf:
- - $ref: './link.yml'
- - description: |-
- This non working days collection
-
- **Resource**: NonWorkingDayCollectionModel
- _embedded:
- type: object
- required:
- - elements
- properties:
- elements:
- type: array
- description: |-
- The array of non working days.
-
- A particular date can appear multiple times as both a non working day and a week day.
- items:
- $ref: './non_working_day_model.yml'
-
-example:
- _type: Collection
- total: 6
- count: 6
- _links:
- self:
- href: '/api/v3/days/work_schedule?filters=[{"interval":{"operator":"<>d","values":["2022-05-01","2022-05-15"]}}]'
- _embedded:
- elements:
- - _type: NonWorkingDay
- date: '2022-05-01'
- name: Labour day
- _links:
- self:
- href: /api/v3/days/non_working/2022-05-01
- title: Labour day
- - _type: NonWorkingDay
- date: '2022-05-01'
- name: Sunday
- _links:
- self:
- href: /api/v3/days/week/7
- title: Sunday
- - _type: NonWorkingDay
- date: '2022-05-07'
- name: Saturday
- _links:
- self:
- href: /api/v3/days/week/6
- title: Saturday
- - _type: NonWorkingDay
- date: '2022-05-08'
- name: Sunday
- _links:
- self:
- href: /api/v3/days/week/7
- title: Sunday
- - _type: NonWorkingDay
- date: '2022-05-14'
- name: Saturday
- _links:
- self:
- href: /api/v3/days/week/6
- title: Saturday
- - _type: NonWorkingDay
- date: '2022-05-15'
- name: Sunday
- _links:
- self:
- href: /api/v3/days/week/7
- title: Sunday
diff --git a/docs/api/apiv3/openapi-spec.yml b/docs/api/apiv3/openapi-spec.yml
index 59a6a111174..a9841e7fef8 100644
--- a/docs/api/apiv3/openapi-spec.yml
+++ b/docs/api/apiv3/openapi-spec.yml
@@ -183,8 +183,10 @@ paths:
"$ref": "./paths/days_week.yml"
"/api/v3/days/week/{day}":
"$ref": "./paths/days_week_day.yml"
- "/api/v3/days/work_schedule":
- "$ref": "./paths/days_work_schedule.yml"
+ "/api/v3/days":
+ "$ref": "./paths/days.yml"
+ "/api/v3/days/{date}":
+ "$ref": "./paths/days_date.yml"
"/api/v3/documents":
"$ref": "./paths/documents.yml"
"/api/v3/documents/{id}":
@@ -510,6 +512,10 @@ components:
"$ref": "./components/schemas/custom_option_model.yml"
CustomactionModel:
"$ref": "./components/schemas/customaction_model.yml"
+ DayCollectionModel:
+ "$ref": "./components/schemas/day_collection_model.yml"
+ DayModel:
+ "$ref": "./components/schemas/day_model.yml"
Default_QueryModel:
"$ref": "./components/schemas/default_query_model.yml"
Default_Query_for_ProjectModel:
@@ -600,8 +606,6 @@ components:
"$ref": "./components/schemas/membership_update_form.yml"
NewsModel:
"$ref": "./components/schemas/news_model.yml"
- NonWorkingDayCollectionModel:
- "$ref": "./components/schemas/non_working_day_collection_model.yml"
NonWorkingDayModel:
"$ref": "./components/schemas/non_working_day_model.yml"
NotificationCollectionModel:
diff --git a/docs/api/apiv3/paths/days_work_schedule.yml b/docs/api/apiv3/paths/days.yml
similarity index 50%
rename from docs/api/apiv3/paths/days_work_schedule.yml
rename to docs/api/apiv3/paths/days.yml
index 6fc61ce7142..cff47067eae 100644
--- a/docs/api/apiv3/paths/days_work_schedule.yml
+++ b/docs/api/apiv3/paths/days.yml
@@ -1,15 +1,15 @@
-# /api/v3/days/work_schedule
+# /api/v3/days
---
get:
- summary: Lists non-working days
- operationId: list_non_working_days
+ summary: Lists days
+ operationId: list_days
tags:
- Work Schedule
description: |-
- Lists non-working days for a given date interval.
+ Lists days information for a given date interval.
- It will return both weekend days and registered non-working days from the
- beginning of current month to the end of following month by default.
+ All days from the beginning of current month to the end of following month
+ are returned by default.
parameters:
- name: filters
in: query
@@ -19,20 +19,20 @@ get:
Accepts the same format as returned by the [queries](https://www.openproject.org/docs/api/endpoints/queries/)
endpoint. Currently supported filters are:
- + interval: the inclusive date interval to scope non-working days to
- look up. When unspecified, default is from the beginning of current
- month to the end of following month.
+ + interval: the inclusive date interval to scope days to look up. When
+ unspecified, default is from the beginning of current month to the end
+ of following month.
Example: `{ "interval": { "operator": "<>d", "values": ["2022-05-02","2022-05-26"] } }`
- would return non-working days between May 5 and May 26 2022, inclusive.
+ would return days between May 5 and May 26 2022, inclusive.
- + type: the type of non-working days to return. Can have the values
- `NonWorkDay` and `WeekDay`. When unspecified, default is
- `["NonWorkingDay", "WeekDay"]`
+ + working: when `true`, returns only the working days. When `false`,
+ returns only the non-working days (weekend days and non-working days).
+ When unspecified, returns both working and non-working days.
- Example: `{ "type": { "operator": "=", "values": ["NonWorkingDay"] } }`
- would return registered non working days only.
- example: '[{ "interval": { "operator": "<>d", "values": ["2022-05-02","2022-05-26"] } }, { "type": { "operator": "=", "values": ["NonWorkingDay"] } }]'
+ Example: `{ "working": { "operator": "=", "values": ["t"] } }`
+ would exclude non-working days from the response.
+ example: '[{ "interval": { "operator": "<>d", "values": ["2022-05-02","2022-05-26"] } }, { "working": { "operator": "=", "values": ["f"] } }]'
required: false
schema:
type: string
@@ -43,7 +43,7 @@ get:
content:
application/hal+json:
schema:
- $ref: '../components/schemas/non_working_day_collection_model.yml'
+ $ref: '../components/schemas/day_collection_model.yml'
'400':
description: |-
Returned if the client sends invalid request parameters.
diff --git a/docs/api/apiv3/paths/days_date.yml b/docs/api/apiv3/paths/days_date.yml
new file mode 100644
index 00000000000..e11f43dc193
--- /dev/null
+++ b/docs/api/apiv3/paths/days_date.yml
@@ -0,0 +1,38 @@
+# /api/v3/days/{date}
+---
+get:
+ summary: View day
+ operationId: view_day
+ tags:
+ - Work Schedule
+ description: |-
+ View the day information for a given date.
+ parameters:
+ - name: date
+ in: path
+ required: true
+ description: |-
+ The date of the non-working day to view in ISO 8601 format.
+ schema:
+ type: string
+ format: date
+ example: '2022-05-06'
+ responses:
+ '200':
+ description: |-
+ OK
+ content:
+ application/hal+json:
+ schema:
+ $ref: '../components/schemas/day_model.yml'
+ '400':
+ description: |-
+ Returned if the client sends invalid request parameters.
+ content:
+ application/hal+json:
+ schema:
+ $ref: '../components/schemas/error_response.yml'
+ example:
+ _type: Error
+ errorIdentifier: urn:openproject-org:api:v3:errors:InvalidRequestBody
+ message: The date is invalid.