All files / src/lib/api-docs/endpoints/dev projects.ts

100% Statements 107/107
100% Branches 0/0
100% Functions 0/0
100% Lines 107/107

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 1081x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x  
/**
 * Dev Projects Endpoints
 * Development project management endpoints
 */
 
import type { ApiEndpoint } from '@/types/api-docs';
 
export const devProjectsEndpoints: ApiEndpoint[] = [
  {
    id: 'dev-projects-list',
    method: 'GET',
    path: '/api/dev/projects',
    summary: 'List dev projects',
    description: 'Returns list of development projects',
    category: 'dev-tickets',
    requiresAuth: true,
    adminOnly: true,
    responses: [
      { status: 200, description: 'List of projects' },
    ],
  },
  {
    id: 'dev-projects-create',
    method: 'POST',
    path: '/api/dev/projects',
    summary: 'Create dev project',
    description: 'Creates a new development project',
    category: 'dev-tickets',
    requiresAuth: true,
    adminOnly: true,
    requestBody: {
      contentType: 'application/json',
      fields: [
        { name: 'name', type: 'string', required: true, description: 'Project name' },
        { name: 'key', type: 'string', required: true, description: 'Project key (e.g., CORE)' },
        { name: 'description', type: 'string', required: false, description: 'Project description' },
        { name: 'color', type: 'string', required: false, description: 'Project color' },
      ],
    },
    responses: [
      { status: 201, description: 'Project created' },
    ],
  },
  {
    id: 'dev-projects-get',
    method: 'GET',
    path: '/api/dev/projects/{id}',
    summary: 'Get project details',
    description: 'Returns project with stats, milestones, and recent sprints',
    category: 'dev-tickets',
    requiresAuth: true,
    adminOnly: true,
    parameters: [
      { name: 'id', type: 'string', required: true, location: 'path', description: 'Project ID' },
    ],
    responses: [
      { status: 200, description: 'Project details with stats' },
      { status: 404, description: 'Project not found' },
    ],
  },
  {
    id: 'dev-projects-update',
    method: 'PATCH',
    path: '/api/dev/projects/{id}',
    summary: 'Update project',
    description: 'Updates project details',
    category: 'dev-tickets',
    requiresAuth: true,
    adminOnly: true,
    parameters: [
      { name: 'id', type: 'string', required: true, location: 'path', description: 'Project ID' },
    ],
    requestBody: {
      contentType: 'application/json',
      fields: [
        { name: 'name', type: 'string', required: false, description: 'Project name' },
        { name: 'key', type: 'string', required: false, description: 'Project key' },
        { name: 'description', type: 'string', required: false, description: 'Project description' },
        { name: 'color', type: 'string', required: false, description: 'Project color' },
        { name: 'leadId', type: 'number', required: false, description: 'Project lead user ID' },
        { name: 'isActive', type: 'boolean', required: false, description: 'Active status' },
      ],
    },
    responses: [
      { status: 200, description: 'Project updated' },
      { status: 404, description: 'Project not found' },
    ],
  },
  {
    id: 'dev-projects-delete',
    method: 'DELETE',
    path: '/api/dev/projects/{id}',
    summary: 'Delete project',
    description: 'Deletes project (fails if tickets exist)',
    category: 'dev-tickets',
    requiresAuth: true,
    adminOnly: true,
    parameters: [
      { name: 'id', type: 'string', required: true, location: 'path', description: 'Project ID' },
    ],
    responses: [
      { status: 200, description: 'Project deleted' },
      { status: 400, description: 'Project has tickets' },
      { status: 404, description: 'Project not found' },
    ],
  },
];