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,69 @@
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
*/
/**
* @swagger
* /api/projects:
* post:
* summary: Create project
* description: Creates a project. The current user automatically becomes a project manager.
* tags:
* - Projects
* requestBody:
* required: true
* content:
* application/json:
* schema:
* type: object
* required:
* - type
* - name
* properties:
* type:
* type: string
* enum: [public, private]
* description: Type of the project
* example: private
* name:
* type: string
* maxLength: 128
* description: Name/title of the project
* example: Development Project
* description:
* type: string
* maxLength: 1024
* nullable: true
* description: Detailed description of the project
* example: A project for developing new features...
* responses:
* 200:
* description: Project created successfully
* content:
* application/json:
* schema:
* type: object
* required:
* - item
* - included
* properties:
* item:
* $ref: '#/components/schemas/Project'
* included:
* type: object
* required:
* - projectManagers
* properties:
* projectManagers:
* type: array
* description: Related project managers
* items:
* $ref: '#/components/schemas/ProjectManager'
* 400:
* $ref: '#/components/responses/ValidationError'
* 401:
* $ref: '#/components/responses/Unauthorized'
*/
module.exports = {
inputs: {
type: {

View File

@@ -3,6 +3,44 @@
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
*/
/**
* @swagger
* /api/projects/{id}:
* delete:
* summary: Delete project
* description: Deletes a project. The project must not have any boards. Requires project manager permissions.
* tags:
* - Projects
* parameters:
* - name: id
* in: path
* required: true
* description: ID of the project to delete
* schema:
* type: string
* example: 1357158568008091264
* responses:
* 200:
* description: Project deleted successfully
* content:
* application/json:
* schema:
* type: object
* required:
* - item
* properties:
* item:
* $ref: '#/components/schemas/Project'
* 400:
* $ref: '#/components/responses/ValidationError'
* 401:
* $ref: '#/components/responses/Unauthorized'
* 404:
* $ref: '#/components/responses/NotFound'
* 422:
* $ref: '#/components/responses/UnprocessableEntity'
*/
const { idInput } = require('../../../utils/inputs');
const Errors = {

View File

@@ -3,6 +3,94 @@
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
*/
/**
* @swagger
* /api/projects:
* get:
* summary: Get all accessible projects
* description: Retrieves all projects the current user has access to, including managed projects, membership projects, and shared projects (for admins).
* tags:
* - Projects
* responses:
* 200:
* description: Projects retrieved successfully
* content:
* application/json:
* schema:
* type: object
* required:
* - items
* - included
* properties:
* items:
* type: array
* items:
* allOf:
* - $ref: '#/components/schemas/Project'
* - type: object
* properties:
* isFavorite:
* type: boolean
* description: Whether the project is marked as favorite by the current user
* example: true
* included:
* type: object
* required:
* - users
* - projectManagers
* - backgroundImages
* - baseCustomFieldGroups
* - boards
* - boardMemberships
* - customFields
* - notificationServices
* properties:
* users:
* type: array
* description: Related users
* items:
* $ref: '#/components/schemas/User'
* projectManagers:
* type: array
* description: Related project managers
* items:
* $ref: '#/components/schemas/ProjectManager'
* backgroundImages:
* type: array
* description: Related background images
* items:
* $ref: '#/components/schemas/BackgroundImage'
* baseCustomFieldGroups:
* type: array
* description: Related base custom field groups
* items:
* $ref: '#/components/schemas/BaseCustomFieldGroup'
* boards:
* type: array
* description: Related boards
* items:
* $ref: '#/components/schemas/Board'
* boardMemberships:
* type: array
* description: Related board memberships (for current user)
* items:
* $ref: '#/components/schemas/BoardMembership'
* customFields:
* type: array
* description: Related custom fields
* items:
* $ref: '#/components/schemas/CustomField'
* notificationServices:
* type: array
* description: Related notification services (for managed projects)
* items:
* $ref: '#/components/schemas/NotificationService'
* 400:
* $ref: '#/components/responses/ValidationError'
* 401:
* $ref: '#/components/responses/Unauthorized'
*/
module.exports = {
async fn() {
const { currentUser } = this.req;

View File

@@ -3,6 +3,102 @@
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
*/
/**
* @swagger
* /api/projects/{id}:
* get:
* summary: Get project details
* description: Retrieves comprehensive project information, including boards, board memberships, and other related data.
* tags:
* - Projects
* parameters:
* - name: id
* in: path
* required: true
* description: ID of the project to retrieve
* schema:
* type: string
* example: 1357158568008091264
* responses:
* 200:
* description: Project details retrieved successfully
* content:
* application/json:
* schema:
* type: object
* required:
* - item
* - included
* properties:
* item:
* allOf:
* - $ref: '#/components/schemas/Project'
* - type: object
* properties:
* isFavorite:
* type: boolean
* description: Whether the project is marked as favorite by the current user
* example: true
* included:
* type: object
* required:
* - users
* - projectManagers
* - backgroundImages
* - baseCustomFieldGroups
* - boards
* - boardMemberships
* - customFields
* - notificationServices
* properties:
* users:
* type: array
* description: Related users
* items:
* $ref: '#/components/schemas/User'
* projectManagers:
* type: array
* description: Related project managers
* items:
* $ref: '#/components/schemas/ProjectManager'
* backgroundImages:
* type: array
* description: Related background images
* items:
* $ref: '#/components/schemas/BackgroundImage'
* baseCustomFieldGroups:
* type: array
* description: Related base custom field groups
* items:
* $ref: '#/components/schemas/BaseCustomFieldGroup'
* boards:
* type: array
* description: Related boards
* items:
* $ref: '#/components/schemas/Board'
* boardMemberships:
* type: array
* description: Related board memberships (for current user)
* items:
* $ref: '#/components/schemas/BoardMembership'
* customFields:
* type: array
* description: Related custom fields
* items:
* $ref: '#/components/schemas/CustomField'
* notificationServices:
* type: array
* description: Related notification services (for managed projects)
* items:
* $ref: '#/components/schemas/NotificationService'
* 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,96 @@
* Licensed under the Fair Use License: https://github.com/plankanban/planka/blob/master/LICENSE.md
*/
/**
* @swagger
* /api/projects/{id}:
* patch:
* summary: Update project
* description: Updates a project. Accessible fields depend on user permissions.
* tags:
* - Projects
* parameters:
* - name: id
* in: path
* required: true
* description: ID of the project to update
* schema:
* type: string
* example: 1357158568008091264
* requestBody:
* required: true
* content:
* application/json:
* schema:
* type: object
* properties:
* ownerProjectManagerId:
* type: string
* nullable: true
* description: ID of the project manager who owns the project
* example: 1357158568008091265
* backgroundImageId:
* type: string
* nullable: true
* description: ID of the background image used as background
* example: 1357158568008091266
* name:
* type: string
* maxLength: 128
* description: Name/title of the project
* example: Development Project
* description:
* type: string
* maxLength: 1024
* nullable: true
* description: Detailed description of the project
* example: A project for developing new features...
* backgroundType:
* type: string
* enum: [gradient, image]
* nullable: true
* description: Type of background for the project
* example: gradient
* backgroundGradient:
* type: string
* enum: [old-lime, ocean-dive, tzepesch-style, jungle-mesh, strawberry-dust, purple-rose, sun-scream, warm-rust, sky-change, green-eyes, blue-xchange, blood-orange, sour-peel, green-ninja, algae-green, coral-reef, steel-grey, heat-waves, velvet-lounge, purple-rain, blue-steel, blueish-curve, prism-light, green-mist, red-curtain]
* nullable: true
* description: Gradient background for the project
* example: ocean-dive
* isHidden:
* type: boolean
* description: Whether the project is hidden
* example: false
* isFavorite:
* type: boolean
* description: Whether the project is marked as favorite by the current user
* example: true
* responses:
* 200:
* description: Project updated successfully
* content:
* application/json:
* schema:
* type: object
* required:
* - item
* properties:
* item:
* $ref: '#/components/schemas/Project'
* 400:
* $ref: '#/components/responses/ValidationError'
* 401:
* $ref: '#/components/responses/Unauthorized'
* 403:
* $ref: '#/components/responses/Forbidden'
* 404:
* $ref: '#/components/responses/NotFound'
* 409:
* $ref: '#/components/responses/Conflict'
* 422:
* $ref: '#/components/responses/UnprocessableEntity'
*/
const { idInput } = require('../../../utils/inputs');
const Errors = {