148 lines
3.7 KiB
JavaScript
148 lines
3.7 KiB
JavaScript
const TransitionsService = require('../services/transitions');
|
|
const TransitionsDBApi = require('../db/api/transitions');
|
|
const { createEntityRouter } = require('../factories/router.factory');
|
|
|
|
/**
|
|
* @swagger
|
|
* components:
|
|
* schemas:
|
|
* Transitions:
|
|
* type: object
|
|
* properties:
|
|
* source_key:
|
|
* type: string
|
|
* name:
|
|
* type: string
|
|
* slug:
|
|
* type: string
|
|
* video_url:
|
|
* type: string
|
|
* audio_url:
|
|
* type: string
|
|
* duration_sec:
|
|
* type: number
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* tags:
|
|
* name: Transitions
|
|
* description: The Transitions managing API
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/transitions:
|
|
* post:
|
|
* security:
|
|
* - bearerAuth: []
|
|
* tags: [Transitions]
|
|
* summary: Add new item
|
|
* requestBody:
|
|
* required: true
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* properties:
|
|
* data:
|
|
* type: object
|
|
* $ref: "#/components/schemas/Transitions"
|
|
* responses:
|
|
* 200:
|
|
* description: The item was successfully added
|
|
* 401:
|
|
* $ref: "#/components/responses/UnauthorizedError"
|
|
* 500:
|
|
* description: Some server error
|
|
* get:
|
|
* security:
|
|
* - bearerAuth: []
|
|
* tags: [Transitions]
|
|
* summary: Get all transitions
|
|
* responses:
|
|
* 200:
|
|
* description: Transitions list successfully received
|
|
* 401:
|
|
* $ref: "#/components/responses/UnauthorizedError"
|
|
* 500:
|
|
* description: Some server error
|
|
*/
|
|
|
|
/**
|
|
* @swagger
|
|
* /api/transitions/{id}:
|
|
* put:
|
|
* security:
|
|
* - bearerAuth: []
|
|
* tags: [Transitions]
|
|
* summary: Update the selected item
|
|
* parameters:
|
|
* - in: path
|
|
* name: id
|
|
* required: true
|
|
* schema:
|
|
* type: string
|
|
* requestBody:
|
|
* required: true
|
|
* content:
|
|
* application/json:
|
|
* schema:
|
|
* properties:
|
|
* id:
|
|
* type: string
|
|
* data:
|
|
* type: object
|
|
* $ref: "#/components/schemas/Transitions"
|
|
* responses:
|
|
* 200:
|
|
* description: The item was successfully updated
|
|
* 401:
|
|
* $ref: "#/components/responses/UnauthorizedError"
|
|
* 404:
|
|
* description: Item not found
|
|
* 500:
|
|
* description: Some server error
|
|
* delete:
|
|
* security:
|
|
* - bearerAuth: []
|
|
* tags: [Transitions]
|
|
* summary: Delete the selected item
|
|
* parameters:
|
|
* - in: path
|
|
* name: id
|
|
* required: true
|
|
* schema:
|
|
* type: string
|
|
* responses:
|
|
* 200:
|
|
* description: The item was successfully deleted
|
|
* 401:
|
|
* $ref: "#/components/responses/UnauthorizedError"
|
|
* 404:
|
|
* description: Item not found
|
|
* 500:
|
|
* description: Some server error
|
|
* get:
|
|
* security:
|
|
* - bearerAuth: []
|
|
* tags: [Transitions]
|
|
* summary: Get selected item
|
|
* parameters:
|
|
* - in: path
|
|
* name: id
|
|
* required: true
|
|
* schema:
|
|
* type: string
|
|
* responses:
|
|
* 200:
|
|
* description: Selected item successfully received
|
|
* 401:
|
|
* $ref: "#/components/responses/UnauthorizedError"
|
|
* 404:
|
|
* description: Item not found
|
|
* 500:
|
|
* description: Some server error
|
|
*/
|
|
|
|
module.exports = createEntityRouter('transitions', TransitionsService, TransitionsDBApi);
|