2022-02-22 05:37:02 +13:00
|
|
|
const controller = require("../../controllers/public/queries")
|
2022-02-23 07:40:09 +13:00
|
|
|
const Endpoint = require("./utils/Endpoint")
|
2022-02-18 07:58:09 +13:00
|
|
|
|
2022-02-23 07:40:09 +13:00
|
|
|
const read = [],
|
|
|
|
write = []
|
2022-02-18 07:58:09 +13:00
|
|
|
|
2022-02-22 05:37:02 +13:00
|
|
|
/**
|
|
|
|
* @openapi
|
|
|
|
* /queries/search:
|
|
|
|
* post:
|
|
|
|
* summary: Search for a query based on its name.
|
|
|
|
* tags:
|
|
|
|
* - queries
|
2022-02-22 08:04:13 +13:00
|
|
|
* parameters:
|
|
|
|
* - $ref: '#/components/parameters/appId'
|
2022-02-23 03:28:57 +13:00
|
|
|
* requestBody:
|
|
|
|
* required: true
|
|
|
|
* content:
|
|
|
|
* application/json:
|
|
|
|
* schema:
|
|
|
|
* $ref: '#/components/schemas/nameSearch'
|
2022-02-22 08:04:13 +13:00
|
|
|
* responses:
|
|
|
|
* 200:
|
|
|
|
* description: Returns the queries found based on the search parameters.
|
|
|
|
* content:
|
|
|
|
* application/json:
|
|
|
|
* schema:
|
2022-02-23 03:10:01 +13:00
|
|
|
* type: object
|
|
|
|
* properties:
|
|
|
|
* queries:
|
|
|
|
* type: array
|
|
|
|
* items:
|
|
|
|
* $ref: '#/components/schemas/query'
|
|
|
|
* examples:
|
|
|
|
* queries:
|
|
|
|
* $ref: '#/components/examples/queries'
|
2022-02-22 05:37:02 +13:00
|
|
|
*/
|
2022-02-23 07:40:09 +13:00
|
|
|
read.push(new Endpoint("post", "/queries/search", controller.search))
|
2022-02-22 05:37:02 +13:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @openapi
|
|
|
|
* /queries/{queryId}:
|
|
|
|
* post:
|
|
|
|
* summary: Execute a query and retrieve its response.
|
|
|
|
* tags:
|
|
|
|
* - queries
|
2022-02-22 08:04:13 +13:00
|
|
|
* parameters:
|
|
|
|
* - $ref: '#/components/parameters/queryId'
|
|
|
|
* - $ref: '#/components/parameters/appId'
|
|
|
|
* responses:
|
|
|
|
* 200:
|
|
|
|
* description: Returns the result of the query execution.
|
|
|
|
* content:
|
|
|
|
* application/json:
|
|
|
|
* schema:
|
|
|
|
* type: array
|
|
|
|
* items:
|
|
|
|
* type: object
|
2022-02-23 03:10:01 +13:00
|
|
|
* examples:
|
|
|
|
* query:
|
|
|
|
* $ref: '#/components/examples/query'
|
2022-02-22 05:37:02 +13:00
|
|
|
*/
|
2022-02-23 07:40:09 +13:00
|
|
|
write.push(new Endpoint("post", "/queries/:queryId", controller.execute))
|
2022-02-22 05:37:02 +13:00
|
|
|
|
2022-02-23 07:40:09 +13:00
|
|
|
module.exports = { read, write }
|