Add crud endpoints for notifications (#801)
Co-authored-by: kolaente <k@knt.li> Reviewed-on: https://kolaente.dev/vikunja/api/pulls/801 Co-authored-by: konrad <konrad@kola-entertainments.de> Co-committed-by: konrad <konrad@kola-entertainments.de>
This commit is contained in:
@ -3901,6 +3901,118 @@ var doc = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"/notifications": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"JWTKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Returns an array with all notifications for the current user.",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"subscriptions"
|
||||
],
|
||||
"summary": "Get all notifications for the current user",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "The page number. Used for pagination. If not provided, the first page of results is returned.",
|
||||
"name": "page",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "The maximum number of items per page. Note this parameter is limited by the configured maximum of items per page.",
|
||||
"name": "per_page",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "The notifications",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/notifications.DatabaseNotification"
|
||||
}
|
||||
}
|
||||
},
|
||||
"403": {
|
||||
"description": "Link shares cannot have notifications.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/web.HTTPError"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.Message"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/notifications/{id}": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"JWTKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Marks a notification as either read or unread. A user can only mark their own notifications as read.",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"subscriptions"
|
||||
],
|
||||
"summary": "Mark a notification as (un-)read",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "Notification ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "The notification to mark as read.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.DatabaseNotifications"
|
||||
}
|
||||
},
|
||||
"403": {
|
||||
"description": "Link shares cannot have notifications.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/web.HTTPError"
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "The notification does not exist.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/web.HTTPError"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.Message"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/register": {
|
||||
"post": {
|
||||
"description": "Creates a new user account.",
|
||||
@ -7200,6 +7312,35 @@ var doc = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.DatabaseNotifications": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"created": {
|
||||
"description": "A timestamp when this notification was created. You cannot change this value.",
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"description": "The unique, numeric id of this notification.",
|
||||
"type": "integer"
|
||||
},
|
||||
"name": {
|
||||
"description": "The name of the notification",
|
||||
"type": "string"
|
||||
},
|
||||
"notification": {
|
||||
"description": "The actual content of the notification.",
|
||||
"type": "object"
|
||||
},
|
||||
"read": {
|
||||
"description": "Whether or not to mark this notification as read or unread.\nTrue is read, false is unread.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"read_at": {
|
||||
"description": "When this notification is marked as read, this will be updated with the current timestamp.",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.Label": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@ -8078,6 +8219,31 @@ var doc = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"notifications.DatabaseNotification": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"created": {
|
||||
"description": "A timestamp when this notification was created. You cannot change this value.",
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"description": "The unique, numeric id of this notification.",
|
||||
"type": "integer"
|
||||
},
|
||||
"name": {
|
||||
"description": "The name of the notification",
|
||||
"type": "string"
|
||||
},
|
||||
"notification": {
|
||||
"description": "The actual content of the notification.",
|
||||
"type": "object"
|
||||
},
|
||||
"read_at": {
|
||||
"description": "When this notification is marked as read, this will be updated with the current timestamp.",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"openid.Callback": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
@ -3884,6 +3884,118 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/notifications": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"JWTKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Returns an array with all notifications for the current user.",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"subscriptions"
|
||||
],
|
||||
"summary": "Get all notifications for the current user",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "The page number. Used for pagination. If not provided, the first page of results is returned.",
|
||||
"name": "page",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "The maximum number of items per page. Note this parameter is limited by the configured maximum of items per page.",
|
||||
"name": "per_page",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "The notifications",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/notifications.DatabaseNotification"
|
||||
}
|
||||
}
|
||||
},
|
||||
"403": {
|
||||
"description": "Link shares cannot have notifications.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/web.HTTPError"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.Message"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/notifications/{id}": {
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
"JWTKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Marks a notification as either read or unread. A user can only mark their own notifications as read.",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"subscriptions"
|
||||
],
|
||||
"summary": "Mark a notification as (un-)read",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "Notification ID",
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "The notification to mark as read.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.DatabaseNotifications"
|
||||
}
|
||||
},
|
||||
"403": {
|
||||
"description": "Link shares cannot have notifications.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/web.HTTPError"
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "The notification does not exist.",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/web.HTTPError"
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal error",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/models.Message"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/register": {
|
||||
"post": {
|
||||
"description": "Creates a new user account.",
|
||||
@ -7183,6 +7295,35 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.DatabaseNotifications": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"created": {
|
||||
"description": "A timestamp when this notification was created. You cannot change this value.",
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"description": "The unique, numeric id of this notification.",
|
||||
"type": "integer"
|
||||
},
|
||||
"name": {
|
||||
"description": "The name of the notification",
|
||||
"type": "string"
|
||||
},
|
||||
"notification": {
|
||||
"description": "The actual content of the notification.",
|
||||
"type": "object"
|
||||
},
|
||||
"read": {
|
||||
"description": "Whether or not to mark this notification as read or unread.\nTrue is read, false is unread.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"read_at": {
|
||||
"description": "When this notification is marked as read, this will be updated with the current timestamp.",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"models.Label": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@ -8061,6 +8202,31 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"notifications.DatabaseNotification": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"created": {
|
||||
"description": "A timestamp when this notification was created. You cannot change this value.",
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"description": "The unique, numeric id of this notification.",
|
||||
"type": "integer"
|
||||
},
|
||||
"name": {
|
||||
"description": "The name of the notification",
|
||||
"type": "string"
|
||||
},
|
||||
"notification": {
|
||||
"description": "The actual content of the notification.",
|
||||
"type": "object"
|
||||
},
|
||||
"read_at": {
|
||||
"description": "When this notification is marked as read, this will be updated with the current timestamp.",
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"openid.Callback": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
@ -229,6 +229,29 @@ definitions:
|
||||
description: A timestamp when this task was last updated. You cannot change this value.
|
||||
type: string
|
||||
type: object
|
||||
models.DatabaseNotifications:
|
||||
properties:
|
||||
created:
|
||||
description: A timestamp when this notification was created. You cannot change this value.
|
||||
type: string
|
||||
id:
|
||||
description: The unique, numeric id of this notification.
|
||||
type: integer
|
||||
name:
|
||||
description: The name of the notification
|
||||
type: string
|
||||
notification:
|
||||
description: The actual content of the notification.
|
||||
type: object
|
||||
read:
|
||||
description: |-
|
||||
Whether or not to mark this notification as read or unread.
|
||||
True is read, false is unread.
|
||||
type: boolean
|
||||
read_at:
|
||||
description: When this notification is marked as read, this will be updated with the current timestamp.
|
||||
type: string
|
||||
type: object
|
||||
models.Label:
|
||||
properties:
|
||||
created:
|
||||
@ -884,6 +907,24 @@ definitions:
|
||||
minLength: 1
|
||||
type: string
|
||||
type: object
|
||||
notifications.DatabaseNotification:
|
||||
properties:
|
||||
created:
|
||||
description: A timestamp when this notification was created. You cannot change this value.
|
||||
type: string
|
||||
id:
|
||||
description: The unique, numeric id of this notification.
|
||||
type: integer
|
||||
name:
|
||||
description: The name of the notification
|
||||
type: string
|
||||
notification:
|
||||
description: The actual content of the notification.
|
||||
type: object
|
||||
read_at:
|
||||
description: When this notification is marked as read, this will be updated with the current timestamp.
|
||||
type: string
|
||||
type: object
|
||||
openid.Callback:
|
||||
properties:
|
||||
code:
|
||||
@ -3643,6 +3684,77 @@ paths:
|
||||
summary: Update a user <-> namespace relation
|
||||
tags:
|
||||
- sharing
|
||||
/notifications:
|
||||
get:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Returns an array with all notifications for the current user.
|
||||
parameters:
|
||||
- description: The page number. Used for pagination. If not provided, the first page of results is returned.
|
||||
in: query
|
||||
name: page
|
||||
type: integer
|
||||
- description: The maximum number of items per page. Note this parameter is limited by the configured maximum of items per page.
|
||||
in: query
|
||||
name: per_page
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: The notifications
|
||||
schema:
|
||||
items:
|
||||
$ref: '#/definitions/notifications.DatabaseNotification'
|
||||
type: array
|
||||
"403":
|
||||
description: Link shares cannot have notifications.
|
||||
schema:
|
||||
$ref: '#/definitions/web.HTTPError'
|
||||
"500":
|
||||
description: Internal error
|
||||
schema:
|
||||
$ref: '#/definitions/models.Message'
|
||||
security:
|
||||
- JWTKeyAuth: []
|
||||
summary: Get all notifications for the current user
|
||||
tags:
|
||||
- subscriptions
|
||||
/notifications/{id}:
|
||||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
description: Marks a notification as either read or unread. A user can only mark their own notifications as read.
|
||||
parameters:
|
||||
- description: Notification ID
|
||||
in: path
|
||||
name: id
|
||||
required: true
|
||||
type: integer
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: The notification to mark as read.
|
||||
schema:
|
||||
$ref: '#/definitions/models.DatabaseNotifications'
|
||||
"403":
|
||||
description: Link shares cannot have notifications.
|
||||
schema:
|
||||
$ref: '#/definitions/web.HTTPError'
|
||||
"404":
|
||||
description: The notification does not exist.
|
||||
schema:
|
||||
$ref: '#/definitions/web.HTTPError'
|
||||
"500":
|
||||
description: Internal error
|
||||
schema:
|
||||
$ref: '#/definitions/models.Message'
|
||||
security:
|
||||
- JWTKeyAuth: []
|
||||
summary: Mark a notification as (un-)read
|
||||
tags:
|
||||
- subscriptions
|
||||
/register:
|
||||
post:
|
||||
consumes:
|
||||
|
Reference in New Issue
Block a user