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
[#40196] added missing endpoints
Eric Schubert0a629440ad3f
diff --git a/docs/api/apiv3/components/schemas/notification_model.yml b/docs/api/apiv3/components/schemas/notification_model.ymlindex 22a1a1c6f64..776d7f93a5f 100644--- a/docs/api/apiv3/components/schemas/notification_model.yml+++ b/docs/api/apiv3/components/schemas/notification_model.yml@@ -45,7 +45,6 @@ properties:type: objectrequired:- self- - readIAN- project- actor- activity@@ -62,7 +61,12 @@ properties:allOf:- "$ref": "./link.yml"- description: |-- Request to mark the notification as read.+ Request to mark the notification as read. Only available if the notification is currently unread.+ unreadIAN:+ allOf:+ - "$ref": "./link.yml"+ - description: |-+ Request to mark the notification as unread. Only available if the notification is currently read.project:allOf:- "$ref": "./link.yml"diff --git a/docs/api/apiv3/openapi-spec.yml b/docs/api/apiv3/openapi-spec.ymlindex bd9611685ab..74dddb4bbd1 100644--- a/docs/api/apiv3/openapi-spec.yml+++ b/docs/api/apiv3/openapi-spec.yml@@ -222,8 +222,16 @@ paths:"$ref": "./paths/news_item.yml""/api/v3/notifications":"$ref": "./paths/notifications.yml"+ "/api/v3/notifications/read_ian":+ "$ref": "./paths/notifications_read.yml"+ "/api/v3/notifications/unread_ian":+ "$ref": "./paths/notifications_unread.yml""/api/v3/notifications/{id}":"$ref": "./paths/notification.yml"+ "/api/v3/notifications/{id}/read_ian":+ "$ref": "./paths/notification_read.yml"+ "/api/v3/notifications/{id}/unread_ian":+ "$ref": "./paths/notification_unread.yml""/api/v3/posts/{id}":"$ref": "./paths/post.yml""/api/v3/posts/{id}/attachments":diff --git a/docs/api/apiv3/paths/notification_read.yml b/docs/api/apiv3/paths/notification_read.ymlnew file mode 100644index 00000000000..8da2a3e44fd--- /dev/null+++ b/docs/api/apiv3/paths/notification_read.yml@@ -0,0 +1,33 @@+# /api/v3/notifications/{id}/read_ian+---+post:+ summary: Read notification+ operationId: Read_Notification+ tags:+ - Notifications+ description: |-+ Marks the given notification as read.+ parameters:+ - name: id+ in: path+ description: notification id+ example: '1'+ required: true+ schema:+ type: integer+ responses:+ '204':+ description: OK+ '404':+ 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.+ description: |-+ Returned if the notification does not exist or if the user does not have permission to view it.++ **Required permission** being recipient of the notificationdiff --git a/docs/api/apiv3/paths/notification_unread.yml b/docs/api/apiv3/paths/notification_unread.ymlnew file mode 100644index 00000000000..1a9cddeaf30--- /dev/null+++ b/docs/api/apiv3/paths/notification_unread.yml@@ -0,0 +1,33 @@+# /api/v3/notifications/{id}/unread_ian+---+post:+ summary: Unread notification+ operationId: Unread_Notification+ tags:+ - Notifications+ description: |-+ Marks the given notification as unread.+ parameters:+ - name: id+ in: path+ description: notification id+ example: '1'+ required: true+ schema:+ type: integer+ responses:+ '204':+ description: OK+ '404':+ 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.+ description: |-+ Returned if the notification does not exist or if the user does not have permission to view it.++ **Required permission** being recipient of the notificationdiff --git a/docs/api/apiv3/paths/notifications_read.yml b/docs/api/apiv3/paths/notifications_read.ymlnew file mode 100644index 00000000000..87f5288caf3--- /dev/null+++ b/docs/api/apiv3/paths/notifications_read.yml@@ -0,0 +1,47 @@+# /api/v3/notifications/read_ian+---+post:+ summary: Read all notifications+ operationId: Read_Notification_Collection+ tags:+ - Notifications+ description: |-+ Marks the whole notification collection as read. The collection contains only elements the authenticated user can+ see, and can be further reduced with filters.+ parameters:+ - 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:++ + id: Filter by primary key++ + project: Filter by the project the notification was created in++ + reason: Filter by the reason, e.g. 'mentioned' or 'assigned' the notification was created because of++ + resourceId: Filter by the id of the resource the notification was created for. Ideally used together with the+ `resourceType` filter.++ + resourceType: Filter by the type of the resource the notification was created for. Ideally used together with+ the `resourceId` filter.+ example: '[{ "reason": { "operator": "=", "values": ["mentioned"] } }]'+ required: false+ schema:+ type: string+ responses:+ '204':+ description: OK+ '400':+ description: Returned if the request is not properly formatted.+ content:+ application/hal+json:+ schema:+ $ref: '../components/schemas/error_response.yml'+ example:+ _type: Error+ errorIdentifier: urn:openproject-org:api:v3:errors:InvalidQuery+ message:+ - Filters Invalid filter does not exist.diff --git a/docs/api/apiv3/paths/notifications_unread.yml b/docs/api/apiv3/paths/notifications_unread.ymlnew file mode 100644index 00000000000..3107a96aaa5--- /dev/null+++ b/docs/api/apiv3/paths/notifications_unread.yml@@ -0,0 +1,47 @@+# /api/v3/notifications/unread_ian+---+post:+ summary: Unread all notifications+ operationId: Unread_Notification_Collection+ tags:+ - Notifications+ description: |-+ Marks the whole notification collection as unread. The collection contains only elements the authenticated user can+ see, and can be further reduced with filters.+ parameters:+ - 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:++ + id: Filter by primary key++ + project: Filter by the project the notification was created in++ + reason: Filter by the reason, e.g. 'mentioned' or 'assigned' the notification was created because of++ + resourceId: Filter by the id of the resource the notification was created for. Ideally used together with the+ `resourceType` filter.++ + resourceType: Filter by the type of the resource the notification was created for. Ideally used together with+ the `resourceId` filter.+ example: '[{ "reason": { "operator": "=", "values": ["mentioned"] } }]'+ required: false+ schema:+ type: string+ responses:+ '204':+ description: OK+ '400':+ description: Returned if the request is not properly formatted.+ content:+ application/hal+json:+ schema:+ $ref: '../components/schemas/error_response.yml'+ example:+ _type: Error+ errorIdentifier: urn:openproject-org:api:v3:errors:InvalidQuery+ message:+ - Filters Invalid filter does not exist.diff --git a/lib/api/v3/notifications/notification_representer.rb b/lib/api/v3/notifications/notification_representer.rbindex b2eb7b92fa7..f7eb4a23472 100644--- a/lib/api/v3/notifications/notification_representer.rb+++ b/lib/api/v3/notifications/notification_representer.rb@@ -34,10 +34,7 @@ module APIinclude API::Decorators::LinkedResourceextend API::Decorators::PolymorphicResource- self_link title_getter: ->(*) { represented.subject }-property :id- property :subjectproperty :read_ian,as: :readIAN