bug-test-api
Version:
Express.js API project: bug-test-api
296 lines (287 loc) • 7.59 kB
JavaScript
/**
* @swagger
* components:
* schemas:
* QuestionOptions:
* type: object
* properties:
* id:
* type: string
* format: uuid
* description: Primary key
* question_id:
* type: string
* format: uuid
* label:
* type: string
* value:
* type: string
* position:
* type: integer
* next_question_id:
* type: string
* format: uuid
* meta:
* type: object
* required:
* - question_id
* - label
* - value
* - position
* example:
* {
* "question_id": "a1b2c3d4-e5f6-4789-9abc-123456789def",
* "label": "Sample label",
* "value": "Sample value",
* "position": 1,
* "next_question_id": "a1b2c3d4-e5f6-4789-9abc-123456789def",
* "meta": {}
* }
*/
/**
* @swagger
* components:
* schemas:
* QuestionOptionsInput:
* type: object
* properties:
* question_id:
* type: string
* format: uuid
* description: Reference ID
* label:
* type: string
* value:
* type: string
* position:
* type: integer
* next_question_id:
* type: string
* format: uuid
* description: Reference ID
* meta:
* type: object
* required:
* - question_id
* - label
* - value
* - position
* example:
* {
* "question_id": "a1b2c3d4-e5f6-4789-9abc-123456789def",
* "label": "Sample label",
* "value": "Sample value",
* "position": 1,
* "next_question_id": "a1b2c3d4-e5f6-4789-9abc-123456789def",
* "meta": {}
* }
*/
/**
* @swagger
* /api/question-options:
* get:
* tags: [QuestionOptions]
* summary: Get all questionoptions
* parameters:
* - in: query
* name: page
* schema:
* type: integer
* default: 1
* description: Page number for pagination
* - in: query
* name: limit
* schema:
* type: integer
* default: 10
* description: Number of items per page
* - in: query
* name: search
* schema:
* type: string
* description: Search term to filter results across text fields
* - in: query
* name: sort
* schema:
* type: string
* description: Field name to sort by (e.g., id, created_at, name)
* - in: query
* name: order
* schema:
* type: string
* enum: [asc, desc]
* default: desc
* description: Sort order (ascending or descending)
* - in: query
* name: id
* schema:
* type: string
* format: uuid
* description: Filter by UUID
* - in: query
* name: question_id
* schema:
* type: string
* format: uuid
* description: Filter by UUID
* - in: query
* name: label
* schema:
* type: string
* description: Filter by text (partial match)
* - in: query
* name: value
* schema:
* type: string
* description: Filter by text (partial match)
* - in: query
* name: position
* schema:
* type: integer
* description: Filter by exact number
* - in: query
* name: next_question_id
* schema:
* type: string
* format: uuid
* description: Filter by UUID
* - in: query
* name: meta
* schema:
* type: object
* description: Filter by value
* responses:
* 200:
* description: List of questionoptions
* content:
* application/json:
* schema:
* type: object
* properties:
* success:
* type: boolean
* data:
* type: array
* items:
* $ref: '#/components/schemas/QuestionOptions'
* pagination:
* type: object
* properties:
* page:
* type: integer
* limit:
* type: integer
* total:
* type: integer
* pages:
* type: integer
*/
/**
* limit:
* type: integer
* total:
* type: integer
* pages:
* type: integer
*/
/**
* @swagger
* /api/question-options/{id}:
* get:
* tags: [QuestionOptions]
* summary: Get questionoptions by ID
* parameters:
* - in: path
* name: id
* required: true
* schema:
* type: string
* format: uuid
* responses:
* 200:
* description: QuestionOptions details
* content:
* application/json:
* schema:
* type: object
* properties:
* success:
* type: boolean
* data:
* $ref: '#/components/schemas/QuestionOptions'
* 404:
* description: QuestionOptions not found
*/
/**
* @swagger
* /api/question-options:
* post:
* tags: [QuestionOptions]
* summary: Create new questionoptions
* requestBody:
* required: true
* content:
* application/json:
* schema:
* $ref: '#/components/schemas/QuestionOptionsInput'
* responses:
* 201:
* description: QuestionOptions created successfully
* content:
* application/json:
* schema:
* type: object
* properties:
* success:
* type: boolean
* message:
* type: string
* data:
* $ref: '#/components/schemas/QuestionOptions'
* 400:
* description: Validation error
*/
/**
* @swagger
* /api/question-options/{id}:
* put:
* tags: [QuestionOptions]
* summary: Update questionoptions
* parameters:
* - in: path
* name: id
* required: true
* schema:
* type: string
* format: uuid
* requestBody:
* required: true
* content:
* application/json:
* schema:
* $ref: '#/components/schemas/QuestionOptionsInput'
* responses:
* 200:
* description: QuestionOptions updated successfully
* 404:
* description: QuestionOptions not found
*/
/**
* @swagger
* /api/question-options/{id}:
* delete:
* tags: [QuestionOptions]
* summary: Delete questionoptions
* parameters:
* - in: path
* name: id
* required: true
* schema:
* type: string
* format: uuid
* responses:
* 200:
* description: QuestionOptions deleted successfully
* 404:
* description: QuestionOptions not found
*/