docs: Add full Swagger JSDoc coverage

This commit is contained in:
Maksim Eltyshev
2025-09-08 16:20:27 +02:00
parent e6b4c33542
commit 5ad3134519
128 changed files with 7610 additions and 0 deletions

View File

@@ -3,6 +3,106 @@
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
*/
/**
* @swagger
* /api/lists/{listId}/cards:
* post:
* summary: Create card
* description: Creates a card within a list. Requires board editor permissions.
* tags:
* - Cards
* parameters:
* - name: listId
* in: path
* required: true
* description: ID of the list to create the card in
* schema:
* type: string
* example: 1357158568008091264
* requestBody:
* required: true
* content:
* application/json:
* schema:
* type: object
* required:
* - type
* - name
* properties:
* type:
* type: string
* enum: [project, story]
* description: Type of the card
* example: project
* position:
* type: number
* minimum: 0
* nullable: true
* description: Position of the card within the list
* example: 65536
* name:
* type: string
* maxLength: 1024
* description: Name/title of the card
* example: Implement user authentication
* description:
* type: string
* maxLength: 1048576
* nullable: true
* description: Detailed description of the card
* example: Add JWT-based authentication system...
* dueDate:
* type: string
* format: date-time
* nullable: true
* description: Due date for the card
* example: 2024-01-01T00:00:00.000Z
* isDueCompleted:
* type: boolean
* nullable: true
* description: Whether the due date is completed
* example: false
* stopwatch:
* type: object
* required:
* - startedAt
* - total
* nullable: true
* description: Stopwatch data for time tracking
* properties:
* startedAt:
* type: string
* format: date-time
* description: When the stopwatch was started
* example: 2024-01-01T00:00:00.000Z
* total:
* type: number
* description: Total time in seconds
* example: 3600
* responses:
* 200:
* description: Card created successfully
* content:
* application/json:
* schema:
* type: object
* required:
* - item
* properties:
* item:
* $ref: '#/components/schemas/Card'
* 400:
* $ref: '#/components/responses/ValidationError'
* 401:
* $ref: '#/components/responses/Unauthorized'
* 403:
* $ref: '#/components/responses/Forbidden'
* 404:
* $ref: '#/components/responses/NotFound'
* 422:
* $ref: '#/components/responses/UnprocessableEntity'
*/
const { isDueDate, isStopwatch } = require('../../../utils/validators');
const { idInput } = require('../../../utils/inputs');

View File

@@ -3,6 +3,44 @@
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
*/
/**
* @swagger
* /api/cards/{id}:
* delete:
* summary: Delete card
* description: Deletes a card and all its contents (tasks, attachments, etc.). Requires board editor permissions.
* tags:
* - Cards
* parameters:
* - name: id
* in: path
* required: true
* description: ID of the card to delete
* schema:
* type: string
* example: 1357158568008091264
* responses:
* 200:
* description: Card deleted successfully
* content:
* application/json:
* schema:
* type: object
* required:
* - item
* properties:
* item:
* $ref: '#/components/schemas/Card'
* 400:
* $ref: '#/components/responses/ValidationError'
* 401:
* $ref: '#/components/responses/Unauthorized'
* 403:
* $ref: '#/components/responses/Forbidden'
* 404:
* $ref: '#/components/responses/NotFound'
*/
const { idInput } = require('../../../utils/inputs');
const Errors = {

View File

@@ -3,6 +3,117 @@
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
*/
/**
* @swagger
* /api/cards/{id}/duplicate:
* post:
* summary: Duplicate card
* description: Creates a duplicate of a card with all its contents (tasks, attachments, etc.). Requires board editor permissions.
* tags:
* - Cards
* parameters:
* - name: id
* in: path
* required: true
* description: ID of the card to duplicate
* schema:
* type: string
* example: 1357158568008091264
* requestBody:
* required: true
* content:
* application/json:
* schema:
* type: object
* required:
* - position
* - name
* properties:
* position:
* type: number
* minimum: 0
* description: Position for the duplicated card within the list
* example: 65536
* name:
* type: string
* maxLength: 1024
* description: Name/title for the duplicated card
* example: Implement user authentication (copy)
* responses:
* 200:
* description: Card duplicated successfully
* content:
* application/json:
* schema:
* type: object
* required:
* - item
* - included
* properties:
* item:
* $ref: '#/components/schemas/Card'
* included:
* type: object
* required:
* - cardMemberships
* - cardLabels
* - taskLists
* - tasks
* - attachments
* - customFieldGroups
* - customFields
* - customFieldValues
* properties:
* cardMemberships:
* type: array
* description: Related card-membership associations
* items:
* $ref: '#/components/schemas/CardMembership'
* cardLabels:
* type: array
* description: Related card-label associations
* items:
* $ref: '#/components/schemas/CardLabel'
* taskLists:
* type: array
* description: Related task lists
* items:
* $ref: '#/components/schemas/TaskList'
* tasks:
* type: array
* description: Related tasks
* items:
* $ref: '#/components/schemas/Task'
* attachments:
* type: array
* description: Related attachments
* items:
* $ref: '#/components/schemas/Attachment'
* customFieldGroups:
* type: array
* description: Related custom field groups
* items:
* $ref: '#/components/schemas/CustomFieldGroup'
* customFields:
* type: array
* description: Related custom fields
* items:
* $ref: '#/components/schemas/CustomField'
* customFieldValues:
* type: array
* description: Related custom field values
* items:
* $ref: '#/components/schemas/CustomFieldValue'
* 400:
* $ref: '#/components/responses/ValidationError'
* 401:
* $ref: '#/components/responses/Unauthorized'
* 403:
* $ref: '#/components/responses/Forbidden'
* 404:
* $ref: '#/components/responses/NotFound'
*/
const { idInput } = require('../../../utils/inputs');
const Errors = {

View File

@@ -3,6 +3,139 @@
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
*/
/**
* @swagger
* /api/lists/{listId}/cards:
* get:
* summary: Get cards in list
* description: Retrieves cards from an endless list with filtering, search, and pagination support.
* tags:
* - Cards
* parameters:
* - name: listId
* in: path
* required: true
* description: ID of the list to get cards from (must be an endless list)
* schema:
* type: string
* example: 1357158568008091264
* - name: before
* in: query
* required: false
* description: Pagination cursor (JSON object with id and listChangedAt)
* schema:
* type: string
* example: '{"id": "1357158568008091269", "listChangedAt": "2024-01-01T00:00:00.000Z"}'
* - name: search
* in: query
* required: false
* description: Search term to filter cards
* schema:
* type: string
* maxLength: 128
* example: bug fix
* - name: filterUserIds
* in: query
* required: false
* description: Comma-separated user IDs to filter by members
* schema:
* type: string
* example: 1357158568008091265,1357158568008091266
* - name: filterLabelIds
* in: query
* required: false
* description: Comma-separated label IDs to filter by labels
* schema:
* type: string
* example: 1357158568008091267,1357158568008091268
* responses:
* 200:
* description: Cards retrieved successfully
* content:
* application/json:
* schema:
* type: object
* required:
* - items
* - included
* properties:
* items:
* type: array
* items:
* allOf:
* - $ref: '#/components/schemas/Card'
* - type: object
* properties:
* isSubscribed:
* type: boolean
* description: Whether the current user is subscribed to the card
* example: true
* included:
* type: object
* required:
* - users
* - cardMemberships
* - cardLabels
* - taskLists
* - tasks
* - attachments
* - customFieldGroups
* - customFields
* - customFieldValues
* properties:
* users:
* type: array
* description: Related users
* items:
* $ref: '#/components/schemas/User'
* cardMemberships:
* type: array
* description: Related card-membership associations
* items:
* $ref: '#/components/schemas/CardMembership'
* cardLabels:
* type: array
* description: Related card-label associations
* items:
* $ref: '#/components/schemas/CardLabel'
* taskLists:
* type: array
* description: Realted Task lists
* items:
* $ref: '#/components/schemas/TaskList'
* tasks:
* type: array
* description: Related tasks
* items:
* $ref: '#/components/schemas/Task'
* attachments:
* type: array
* description: Related attachments
* items:
* $ref: '#/components/schemas/Attachment'
* customFieldGroups:
* type: array
* description: Related custom field groups
* items:
* $ref: '#/components/schemas/CustomFieldGroup'
* customFields:
* type: array
* description: Related custom fields
* items:
* $ref: '#/components/schemas/CustomField'
* customFieldValues:
* type: array
* description: Related custom field values
* items:
* $ref: '#/components/schemas/CustomFieldValue'
* 400:
* $ref: '#/components/responses/ValidationError'
* 401:
* $ref: '#/components/responses/Unauthorized'
* 404:
* $ref: '#/components/responses/NotFound'
*/
const moment = require('moment');
const { isId } = require('../../../utils/validators');

View File

@@ -3,6 +3,53 @@
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
*/
/**
* @swagger
* /api/cards/{id}/read-notifications:
* post:
* summary: Mark card notifications as read
* description: Marks all notifications for a specific card as read for the current user. Requires access to the card.
* tags:
* - Cards
* parameters:
* - name: id
* in: path
* required: true
* description: ID of the card to mark notifications as read for
* schema:
* type: string
* example: 1357158568008091264
* responses:
* 200:
* description: Notifications marked as read successfully
* content:
* application/json:
* schema:
* type: object
* required:
* - item
* - included
* properties:
* item:
* $ref: '#/components/schemas/Card'
* included:
* type: object
* required:
* - notifications
* properties:
* notifications:
* type: array
* description: Related notifications
* items:
* $ref: '#/components/schemas/Notification'
* 400:
* $ref: '#/components/responses/ValidationError'
* 401:
* $ref: '#/components/responses/Unauthorized'
* 404:
* $ref: '#/components/responses/NotFound'
*/
const { idInput } = require('../../../utils/inputs');
const Errors = {

View File

@@ -3,6 +3,108 @@
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
*/
/**
* @swagger
* /api/cards/{id}:
* get:
* summary: Get card details
* description: Retrieves comprehensive card information, including tasks, attachments, and other related data.
* tags:
* - Cards
* parameters:
* - name: id
* in: path
* required: true
* description: ID of the card to retrieve
* schema:
* type: string
* example: 1357158568008091264
* responses:
* 200:
* description: Card details retrieved successfully
* content:
* application/json:
* schema:
* type: object
* required:
* - item
* - included
* properties:
* item:
* allOf:
* - $ref: '#/components/schemas/Card'
* - type: object
* properties:
* isSubscribed:
* type: boolean
* description: Whether the current user is subscribed to the card
* example: true
* included:
* type: object
* required:
* - users
* - cardMemberships
* - cardLabels
* - taskLists
* - tasks
* - attachments
* - customFieldGroups
* - customFields
* - customFieldValues
* properties:
* users:
* type: array
* description: Related users
* items:
* $ref: '#/components/schemas/User'
* cardMemberships:
* type: array
* description: Related card-membership associations
* items:
* $ref: '#/components/schemas/CardMembership'
* cardLabels:
* type: array
* description: Related card-label associations
* items:
* $ref: '#/components/schemas/CardLabel'
* taskLists:
* type: array
* description: Related task lists
* items:
* $ref: '#/components/schemas/TaskList'
* tasks:
* type: array
* description: Related tasks
* items:
* $ref: '#/components/schemas/Task'
* attachments:
* type: array
* description: Related attachments
* items:
* $ref: '#/components/schemas/Attachment'
* customFieldGroups:
* type: array
* description: Related custom field groups
* items:
* $ref: '#/components/schemas/CustomFieldGroup'
* customFields:
* type: array
* description: Related custom fields
* items:
* $ref: '#/components/schemas/CustomField'
* customFieldValues:
* type: array
* description: Related custom field values
* items:
* $ref: '#/components/schemas/CustomFieldValue'
* 400:
* $ref: '#/components/responses/ValidationError'
* 401:
* $ref: '#/components/responses/Unauthorized'
* 404:
* $ref: '#/components/responses/NotFound'
*/
const { idInput } = require('../../../utils/inputs');
const Errors = {

View File

@@ -3,6 +3,119 @@
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
*/
/**
* @swagger
* /api/cards/{id}:
* patch:
* summary: Update card
* description: Updates a card. Board editors can update all fields, viewers can only subscribe/unsubscribe.
* tags:
* - Cards
* parameters:
* - name: id
* in: path
* required: true
* description: ID of the card to update
* schema:
* type: string
* example: 1357158568008091264
* requestBody:
* required: true
* content:
* application/json:
* schema:
* type: object
* properties:
* boardId:
* type: string
* description: ID of the board to move the card to
* example: 1357158568008091265
* listId:
* type: string
* description: ID of the list to move the card to
* example: 1357158568008091266
* coverAttachmentId:
* type: string
* nullable: true
* description: ID of the attachment used as cover
* example: 1357158568008091267
* type:
* type: string
* enum: [project, story]
* description: Type of the card
* example: project
* position:
* type: number
* minimum: 0
* nullable: true
* description: Position of the card within the list
* example: 65536
* name:
* type: string
* maxLength: 1024
* description: Name/title of the card
* example: Implement user authentication
* description:
* type: string
* maxLength: 1048576
* nullable: true
* description: Detailed description of the card
* example: Add JWT-based authentication system...
* dueDate:
* type: string
* format: date-time
* nullable: true
* description: Due date for the card
* example: 2024-01-01T00:00:00.000Z
* isDueCompleted:
* type: boolean
* nullable: true
* description: Whether the due date is completed
* example: false
* stopwatch:
* type: object
* required:
* - startedAt
* - total
* nullable: true
* description: Stopwatch data for time tracking
* properties:
* startedAt:
* type: string
* format: date-time
* description: When the stopwatch was started
* example: 2024-01-01T00:00:00.000Z
* total:
* type: number
* description: Total time in seconds
* example: 3600
* isSubscribed:
* type: boolean
* description: Whether the current user is subscribed to the card
* responses:
* 200:
* description: Card updated successfully
* content:
* application/json:
* schema:
* type: object
* required:
* - item
* properties:
* item:
* $ref: '#/components/schemas/Card'
* 400:
* $ref: '#/components/responses/ValidationError'
* 401:
* $ref: '#/components/responses/Unauthorized'
* 403:
* $ref: '#/components/responses/Forbidden'
* 404:
* $ref: '#/components/responses/NotFound'
* 422:
* $ref: '#/components/responses/UnprocessableEntity'
*/
const { isDueDate, isStopwatch } = require('../../../utils/validators');
const { idInput } = require('../../../utils/inputs');