Skip to content

Commit

Permalink
fix(swagger)
Browse files Browse the repository at this point in the history
  • Loading branch information
kmsngh committed Aug 18, 2020
1 parent 34a63d1 commit 18713f8
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 8 deletions.
28 changes: 20 additions & 8 deletions src/routes/admins/admins.ctrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,25 @@ var genRandomString = function (length) {

/** @swagger
* parameters:
* adminAuth@header:
* name: x-token
* in: header
* description: access token provided to admin
* required: true
* type: UUID
* adminAuth@header:
* name: x-token
* in: header
* description: access token provided to admin
* required: true
* type: string
* responses:
* 200:
* description: Success
* 204:
* description: No Content
* 400:
* description: Bad Request
* 401:
* description: Unauthorized
* 404:
* description: Not Found
* 500:
* description: Internal Server Error
*/

/** @swagger
Expand Down Expand Up @@ -60,8 +73,7 @@ exports.login = async (ctx) => {
};

/**
* GET /admins/check
* {email, password}
* GET /admins/check?access_token
*/
exports.check = async (ctx) => {
const url = new URLSearchParams(ctx.url.split("?")[1]);
Expand Down
39 changes: 39 additions & 0 deletions src/routes/banners/banners.ctrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,19 @@ const models = require("../../database/models");
* link:
* type: string
* required: true
* responses:
* 200:
* description: Success
* 204:
* description: No Content
* 400:
* description: Bad Request
* 401:
* description: Unauthorized
* 404:
* description: Not Found
* 500:
* description: Internal Server Error
*/
exports.upload = async (ctx) => {
const { url, link } = ctx.request.body;
Expand All @@ -40,6 +53,19 @@ exports.upload = async (ctx) => {
* get:
* summary: obtain all banners
* tags: [Banners]
* responses:
* 200:
* description: Success
* 204:
* description: No Content
* 400:
* description: Bad Request
* 401:
* description: Unauthorized
* 404:
* description: Not Found
* 500:
* description: Internal Server Error
*/
exports.list = async (ctx) => {
await models.banner
Expand All @@ -65,6 +91,19 @@ exports.list = async (ctx) => {
* schema:
* type: string
* required: true
* responses:
* 200:
* description: Success
* 204:
* description: No Content
* 400:
* description: Bad Request
* 401:
* description: Unauthorized
* 404:
* description: Not Found
* 500:
* description: Internal Server Error
*/
exports.remove = async (ctx) => {
const { id } = ctx.params;
Expand Down

0 comments on commit 18713f8

Please sign in to comment.