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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
[#41816] Non working days API
Christophe Bliardf36d9e068326
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.ymlnew file mode 100644index 00000000000..0f585f9856a--- /dev/null+++ b/docs/api/apiv3/components/schemas/non_working_day_collection_model.yml@@ -0,0 +1,86 @@+# 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/work_schedule/non_working_days?include_weekend=true&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/work_schedule/non_working_days/2022-05-01+ title: Labour day+ - _type: NonWorkingDay+ date: '2022-05-01'+ name: Sunday+ _links:+ self:+ href: /api/v3/work_schedule/week_days/7+ title: Sunday+ - _type: NonWorkingDay+ date: '2022-05-07'+ name: Saturday+ _links:+ self:+ href: /api/v3/work_schedule/week_days/6+ title: Saturday+ - _type: NonWorkingDay+ date: '2022-05-08'+ name: Sunday+ _links:+ self:+ href: /api/v3/work_schedule/week_days/7+ title: Sunday+ - _type: NonWorkingDay+ date: '2022-05-14'+ name: Saturday+ _links:+ self:+ href: /api/v3/work_schedule/week_days/6+ title: Saturday+ - _type: NonWorkingDay+ date: '2022-05-15'+ name: Sunday+ _links:+ self:+ href: /api/v3/work_schedule/week_days/7+ title: Sundaydiff --git a/docs/api/apiv3/components/schemas/non_working_day_model.yml b/docs/api/apiv3/components/schemas/non_working_day_model.ymlnew file mode 100644index 00000000000..31c81037010--- /dev/null+++ b/docs/api/apiv3/components/schemas/non_working_day_model.yml@@ -0,0 +1,41 @@+# Schema: NonWorkingDayModel+---+type: object+required:+ - _type+ - date+ - name+ - _links+properties:+ _type:+ type: string+ enum:+ - NonWorkingDay+ date:+ type: string+ format: date+ description: Date of the non-working day.+ name:+ type: string+ description: Descriptive name for the non-working day.+ _links:+ type: object+ required:+ - self+ properties:+ self:+ allOf:+ - $ref: './link.yml'+ - description: |-+ This non working day. If the non-working day is recurring like a weekend day, the resource will point to a+ week day.++ **Resource**: NonWorkingDay or WeekDay+example:+ _type: NonWorkingDay+ date: '2022-05-07'+ name: Saturday+ _links:+ self:+ href: /api/v3/work_schedule/non_working_days/2022-05-07+ title: Saturdaydiff --git a/docs/api/apiv3/components/schemas/week_day_collection_model.yml b/docs/api/apiv3/components/schemas/week_day_collection_model.ymlnew file mode 100644index 00000000000..21adcef9f79--- /dev/null+++ b/docs/api/apiv3/components/schemas/week_day_collection_model.yml@@ -0,0 +1,98 @@+# Schema: WeekDayCollectionModel+---+allOf:+ - $ref: './collection_model.yml'+ - type: object+ required:+ - _links+ - _embedded+ properties:+ _links:+ type: object+ required:+ - self+ properties:+ self:+ allOf:+ - $ref: "./link.yml"+ - description: |-+ This week days collection++ **Resource**: WeekDayCollectionModel+ _embedded:+ type: object+ required:+ - elements+ properties:+ elements:+ type: array+ description: |-+ The array of week days.+ items:+ $ref: './week_day_model.yml'++example:+ _type: Collection+ total: 7+ count: 7+ _links:+ self:+ href: /api/v3/work_schedule/week_days+ _embedded:+ elements:+ - _type: WeekDay+ day: 1+ name: Monday+ working: true+ _links:+ self:+ href: /api/v3/work_schedule/week_days/1+ title: Monday+ - _type: WeekDay+ day: 2+ name: Tuesday+ working: true+ _links:+ self:+ href: /api/v3/work_schedule/week_days/2+ title: Tuesday+ - _type: WeekDay+ day: 3+ name: Wednesday+ working: true+ _links:+ self:+ href: /api/v3/work_schedule/week_days/3+ title: Wednesday+ - _type: WeekDay+ day: 4+ name: Thursday+ working: true+ _links:+ self:+ href: /api/v3/work_schedule/week_days/4+ title: Thursday+ - _type: WeekDay+ day: 5+ name: Friday+ working: true+ _links:+ self:+ href: /api/v3/work_schedule/week_days/5+ title: Friday+ - _type: WeekDay+ day: 6+ name: Saturday+ working: false+ _links:+ self:+ href: /api/v3/work_schedule/week_days/6+ title: Saturday+ - _type: WeekDay+ day: 7+ name: Sunday+ working: false+ _links:+ self:+ href: /api/v3/work_schedule/week_days/7+ title: Sundaydiff --git a/docs/api/apiv3/components/schemas/week_day_model.yml b/docs/api/apiv3/components/schemas/week_day_model.ymlnew file mode 100644index 00000000000..973112d4784--- /dev/null+++ b/docs/api/apiv3/components/schemas/week_day_model.yml@@ -0,0 +1,48 @@+# Schema: WeekDayModel+---+type: object+required:+ - _type+ - day+ - name+ - working+properties:+ _type:+ type: string+ enum:+ - WeekDay+ day:+ type: integer+ description: |-+ The week day from 1 to 7. 1 is Monday. 7 is Sunday.+ readOnly: true+ minimum: 1+ maximum: 7+ name:+ type: string+ description: |-+ The week day name.+ working:+ type: boolean+ description: |-+ `true` for a working day. `false` for a weekend day.+ _links:+ type: object+ properties:+ self:+ allOf:+ - "$ref": "./link.yml"+ - description: |-+ This week day resource link.++ **Resource**: WeekDay+ readOnly: true+example:+ _type: WeekDay+ day: 5+ name: Friday+ working: false+ _links:+ self:+ href: "/api/v3/work_schedule/week_day/5"+ title: Fridaydiff --git a/docs/api/apiv3/openapi-spec.yml b/docs/api/apiv3/openapi-spec.ymlindex a72a0cb2916..d3a235d0dac 100644--- a/docs/api/apiv3/openapi-spec.yml+++ b/docs/api/apiv3/openapi-spec.yml@@ -1,5 +1,6 @@---openapi: 3.0.0+info:description: |-You're looking at the current **stable** documentation of the OpenProject APIv3. If you're interested in the current@@ -84,7 +85,7 @@ info:You can then use one the following guides to perform the supported OAuth 2.0 flows:- [Authorization code flow](https://oauth.net/2/grant-types/authorization-code)-+- [Authorization code flow with PKCE](https://doorkeeper.gitbook.io/guides/ruby-on-rails/pkce-flow), recommended for clients unable to keep the client_secret confidential.- [Client credentials](https://oauth.net/2/grant-types/client-credentials/) - Requires an application to be bound to an impersonating user for non-public access@@ -134,6 +135,7 @@ info:If no `Accept-Encoding` header is send, `Accept-Encoding: identity` is assumed which will result in the API responding uncompressed.title: OpenProject API V3 (Stable)version: '3'+servers:- url: https://qa.openproject-edge.comdescription: Edge QA instance@@ -141,6 +143,7 @@ servers:description: Staging instance- url: https://community.openproject.orgdescription: Community instance+paths:"/api/v3":"$ref": "./paths/root.yml"@@ -420,6 +423,21 @@ paths:"$ref": "./paths/work_package_watchers.yml""/api/v3/work_packages/{id}/watchers/{user_id}":"$ref": "./paths/work_package_watcher.yml"+ "/api/v3/work_schedule/week_days":+ # TODO: patch+ "$ref": "./paths/work_schedule_week_days.yml"+ "/api/v3/work_schedule/week_days/{day}":+ "$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:Project:@@ -438,6 +456,7 @@ components:"$ref": "./components/examples/view_work_packages_table.yml"ViewTeamPlanner:"$ref": "./components/examples/view_team_planner.yml"+schemas:ActivityModel:"$ref": "./components/schemas/activity_model.yml"@@ -585,6 +604,10 @@ 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:"$ref": "./components/schemas/notification_collection_model.yml"NotificationModel:@@ -753,6 +776,10 @@ components:"$ref": "./components/schemas/view_user_schema_model.yml"WatchersModel:"$ref": "./components/schemas/watchers_model.yml"+ WeekDayCollectionModel:+ "$ref": "./components/schemas/week_day_collection_model.yml"+ WeekDayModel:+ "$ref": "./components/schemas/week_day_model.yml"Wiki_PageModel:"$ref": "./components/schemas/wiki_page_model.yml"Work_PackageModel:diff --git a/docs/api/apiv3/paths/work_schedule_non_working_day.yml b/docs/api/apiv3/paths/work_schedule_non_working_day.ymlnew file mode 100644index 00000000000..575d30498ce--- /dev/null+++ b/docs/api/apiv3/paths/work_schedule_non_working_day.yml@@ -0,0 +1,54 @@+---+# TODO: add missing description, missing tags, missing parameters, and missing response codes+get:+ summary: View a non-working day+ operationId: view_non_working_day+ 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++# 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+ 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++# TODO: add missing description, missing tags, missing parameters, and missing response codes+delete:+ summary: Remove a day from the non-working days+ operationId: delete_non_working_day+ 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: OKdiff --git a/docs/api/apiv3/paths/work_schedule_non_working_days.yml b/docs/api/apiv3/paths/work_schedule_non_working_days.ymlnew file mode 100644index 00000000000..5f6bdc454d8--- /dev/null+++ b/docs/api/apiv3/paths/work_schedule_non_working_days.yml@@ -0,0 +1,106 @@+---+get:+ summary: Lists non-working days+ operationId: list_non_working_days+ tags:+ - Work Schedule+ - Non working days+ description: |-+ Lists non-working days for a given date interval.+ parameters:+ - name: include_weekend+ in: query+ description: |-+ Include weekend days in the response when `true`.+ required: false+ schema:+ default: false+ type: boolean+ - name: filters+ in: query+ description: |-+ JSON specifying filter conditions.++ 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.++ Example: `{ "interval": { "operator": "<>d", "values": ["2022-05-02","2022-05-26"] } }` would return non working days+ between May 5 and May 26 2022, inclusive.+ example: '[{ "interval": { "operator": "<>d", "values": ["2022-05-02","2022-05-26"] } }]'+ required: false+ schema:+ type: string+ responses:+ '200':+ description: OK+ content:+ application/hal+json:+ schema:+ $ref: '../components/schemas/non_working_day_collection_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 request body was not a single JSON object.+post:+ summary: Create a non working day+ operationId: create_non_working_day+ tags:+ - Work Schedule+ - Non working days+ description: |-+ Marks a day as being a non-working day.++ Does nothing if the day is already a non-working day.+ parameters:+ - name: date+ in: query+ description: |-+ The date to mark as non-working.+ required: true+ schema:+ type: string+ format: date+ example: '2022-12-25'+ - name: name+ in: query+ description: |-+ A descriptive name for the non-working day.+ required: false+ schema:+ type: string+ example: 'Christmas'+ 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'+ example:+ _type: Error+ errorIdentifier: urn:openproject-org:api:v3:errors:InvalidRequestBody+ message: The request body was not a single JSON object.+ '403':+ description: Returned if the client does not have sufficient permissions.+ content:+ application/hal+json:+ schema:+ $ref: '../components/schemas/error_response.yml'+ example:+ _type: Error+ errorIdentifier: urn:openproject-org:api:v3:errors:InvalidQuery+ message: You are not authorized to access this resource.diff --git a/docs/api/apiv3/paths/work_schedule_week_day.yml b/docs/api/apiv3/paths/work_schedule_week_day.ymlnew file mode 100644index 00000000000..a16cabb2066--- /dev/null+++ b/docs/api/apiv3/paths/work_schedule_week_day.yml@@ -0,0 +1,126 @@+---+get:+ summary: View a week day+ operationId: view_week_day+ tags:+ - Work Schedule+ - Week day+ description: |-+ View a week day and its attributes.+ parameters:+ - name: day+ in: path+ required: true+ description: |-+ The week day from 1 to 7. 1 is Monday. 7 is Sunday.+ schema:+ type: integer+ minimum: 1+ maximum: 7+ responses:+ '200':+ description: OK+ content:+ application/hal+json:+ schema:+ $ref: '../components/schemas/week_day_model.yml'+ '400':+ description: |-+ Occurs if the client sends an invalid request.+ content:+ application/hal+json:+ schema:+ $ref: '../components/schemas/error_response.yml'+ example:+ _type: Error+ errorIdentifier: urn:openproject-org:api:v3:errors:InvalidRequestBody+ message: The request body was not a single JSON object.+ '422':+ description: |-+ Occurs if the request body was correctly formatted, but some properties lead to errors in the validation+ process. This happens for example if the day is out of the 1-7 range.+ content:+ application/hal+json:+ schema:+ $ref: "../components/schemas/error_response.yml"+ examples:+ response:+ value:+ _type: Error+ errorIdentifier: urn:openproject-org:api:v3:errors:PropertyConstraintViolation+ message: The request was invalid. Expected day to be between 1 and 7.++patch:+ summary: Update a week day attributes+ operationId: update_week_day+ description: |-+ Makes a week day a working or non-working day.++ TODO: describe what should happen if a working attribute of a week day is changed and the impact it will have on+ work packages scheduling once the behavior has been specified.+ tags:+ - Work Schedule+ - Week day+ parameters:+ - name: day+ in: path+ required: true+ description: |-+ The week day from 1 to 7. 1 is Monday. 7 is Sunday.+ schema:+ type: integer+ minimum: 1+ maximum: 7+ - name: working+ in: query+ required: true+ description: |-+ Set to `true` to make this week day a working day. Set to `false` to make it a non-working day.+ schema:+ type: boolean+ responses:+ '200':+ description: |-+ Update succeeded.++ Response will include the week day with updated attributes.+ content:+ application/hal+json:+ schema:+ $ref: '../components/schemas/week_day_model.yml'+ '400':+ description: |-+ Occurs if the client sends an invalid request.+ content:+ application/hal+json:+ schema:+ $ref: '../components/schemas/error_response.yml'+ example:+ _type: Error+ errorIdentifier: urn:openproject-org:api:v3:errors:InvalidRequestBody+ message: The request body was not a single JSON object.+ '403':+ description: |-+ Returned if the client does not have sufficient permissions.+ content:+ application/hal+json:+ schema:+ $ref: '../components/schemas/error_response.yml'+ example:+ _type: Error+ errorIdentifier: urn:openproject-org:api:v3:errors:InvalidQuery+ message: You are not authorized to access this resource.+ '422':+ description: |-+ Occurs if the request body was correctly formatted, but some properties lead to errors in the validation+ process. This happens for example if the day is out of the 1-7 range.+ content:+ application/hal+json:+ schema:+ $ref: "../components/schemas/error_response.yml"+ examples:+ response:+ value:+ _type: Error+ errorIdentifier: urn:openproject-org:api:v3:errors:PropertyConstraintViolation+ message: The request was invalid. Expected day to be between 1 and 7.diff --git a/docs/api/apiv3/paths/work_schedule_week_days.yml b/docs/api/apiv3/paths/work_schedule_week_days.ymlnew file mode 100644index 00000000000..b54bb24b684--- /dev/null+++ b/docs/api/apiv3/paths/work_schedule_week_days.yml@@ -0,0 +1,27 @@+---+get:+ summary: Lists week days+ operationId: list_week_days+ tags:+ - Work Schedule+ - Non working days+ - Week days+ description: |-+ Lists week days with work schedule information.+ responses:+ '200':+ description: OK+ content:+ application/hal+json:+ schema:+ $ref: '../components/schemas/week_day_collection_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 request body was not a single JSON object.