Skip to content

Commit

Permalink
#275 [Backend] New Spec 23042023
Browse files Browse the repository at this point in the history
  • Loading branch information
fdhhhdjd committed Apr 24, 2023
1 parent f9eb9e7 commit 96c06ab
Show file tree
Hide file tree
Showing 21 changed files with 1,440 additions and 11 deletions.
2 changes: 1 addition & 1 deletion backend-manager-student/src/admin_api/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ app.use((error, req, res, next) => {
const message = error.message || MESSAGES.GENERAL.INTERNAL_SERVER;
return res.status(statusCode).json({
status: statusCode,
stack: CONFIGS.NODE_ENV === CONSTANTS.ENVIRONMENT_DEV ? error.stack : MESSAGES.MEDIA.STRING_EMPTY,
stack: CONFIGS.NODE_ENV === CONSTANTS.ENVIRONMENT_DEV ? error.stack : MESSAGES.GENERAL.STRING_EMPTY,
message: returnReasons(CONSTANTS.HTTP.STATUS_4XX_NOT_FOUND),
element: message,
});
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,361 @@
#!@author Nguyễn Tiến Tài
#!created_at 08/02/2023
#!description: General
# Info Swagger Admin APi
info:
title: Document Admin
description: CURD industry-code
version: 1.0.0
servers:
- url: http://localhost:5000
description: Local development server admin api
# General
components:
# Parameter
parameters:
X-DEVICE-ID:
in: header
name: X-DEVICE-ID
required: true
schema:
type: string
X-OS-TYPE:
in: header
name: X-OS-TYPE
required: true
schema:
type: string
X-OS-VERSION:
in: header
name: X-OS-VERSION
required: true
schema:
type: string
X-APP-VERSION:
in: header
name: X-APP-VERSION
required: true
schema:
type: string
X-DEVICE-NAME:
in: header
name: X-DEVICE-NAME
required: true
schema:
type: string
TOKEN:
in: header
name: Authorization
type: string
description: Bearer Token
required: true
schema:
type: bearerToken
# Unauthorized
responses:
UnauthorizedError:
description: Access token is missing or invalid, or the user does not have access to perform the action,or or Device Invalid
content:
application/json:
schema:
type: object
properties:
status:
type: integer
example: 400
message:
type: string
example: 'Unauthorized'
# Fail CURD Fail
ServerCURDFail:
description: CURD Fail !!!
content:
application/json:
schema:
type: object
properties:
status:
type: integer
example: 500
message:
type: string
example: Service Unavailable
element:
type: object
example: Internal Server Error
ServerFail:
description: Service die
content:
application/json:
schema:
type: object
properties:
status:
type: integer
example: 503
message:
type: string
example: Service Unavailable
element:
type: object
example: Out Of Service
#!@author Nguyễn Tiến Tài
#!created_at 24/04/2023
#!description: create IndustryCode
paths:
/v1/admin/private/industry-code/create:
post:
summary: Create industryCode
tags: [Create industryCode]
operationId: createIndustryCode
parameters:
- $ref: '#/components/parameters/COOKIE-CLIENT'
- $ref: '#/components/parameters/X-DEVICE-ID'
- $ref: '#/components/parameters/X-OS-TYPE'
- $ref: '#/components/parameters/X-OS-VERSION'
- $ref: '#/components/parameters/X-APP-VERSION'
- $ref: '#/components/parameters/X-DEVICE-NAME'
- $ref: '#/components/parameters/TOKEN'
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
input:
type: object
properties:
industry_input:
type: object
properties:
name:
type: string
example: Tai
required:
- name
responses:
200:
description: Create success
content:
application/json:
schema:
type: object
properties:
status:
type: integer
example: 200
message:
type: string
example: Success
400:
description: Invalid input
content:
application/json:
schema:
type: object
properties:
status:
type: integer
example: 400
message:
type: string
example: Bad Request
503:
$ref: '#/components/responses/ServerFail'

#!@author Nguyễn Tiến Tài
#!created_at 24/04/2023
#!description: update IndustryCode
/v1/admin/private/industry-code/update:
post:
summary: Update IndustryCode
tags: [Update IndustryCode]
operationId: updateIndustryCode
parameters:
- $ref: '#/components/parameters/COOKIE-CLIENT'
- $ref: '#/components/parameters/X-DEVICE-ID'
- $ref: '#/components/parameters/X-OS-TYPE'
- $ref: '#/components/parameters/X-OS-VERSION'
- $ref: '#/components/parameters/X-APP-VERSION'
- $ref: '#/components/parameters/X-DEVICE-NAME'
- $ref: '#/components/parameters/TOKEN'
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
input:
type: object
properties:
industry_input:
type: object
properties:
industry_code_id:
type: string
example: 1475825111725506562
name:
type: string
example: Tai
required:
- industry_code_id
- name
responses:
200:
description: update success
content:
application/json:
schema:
type: object
properties:
status:
type: integer
example: 200
message:
type: string
example: Success
400:
description: Invalid input
content:
application/json:
schema:
type: object
properties:
status:
type: integer
example: 400
message:
type: string
example: Bad Request
503:
$ref: '#/components/responses/ServerFail'

#!@author Nguyễn Tiến Tài
#!created_at 24/04/2023
#!description: delete IndustryCode
/v1/admin/private/industry-code/delete:
post:
summary: Delete IndustryCode
tags: [Delete IndustryCode]
operationId: deleteIndustryCode
parameters:
- $ref: '#/components/parameters/COOKIE-CLIENT'
- $ref: '#/components/parameters/X-DEVICE-ID'
- $ref: '#/components/parameters/X-OS-TYPE'
- $ref: '#/components/parameters/X-OS-VERSION'
- $ref: '#/components/parameters/X-APP-VERSION'
- $ref: '#/components/parameters/X-DEVICE-NAME'
- $ref: '#/components/parameters/TOKEN'
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
input:
type: object
properties:
industry_input:
type: object
properties:
industry_code_id:
type: string
example: 1474830717476143106
required:
- industry_code_id
responses:
200:
description: Delete success
content:
application/json:
schema:
type: object
properties:
status:
type: integer
example: 200
message:
type: string
example: Success
400:
description: Invalid input
content:
application/json:
schema:
type: object
properties:
status:
type: integer
example: 400
message:
type: string
example: Bad Request
503:
$ref: '#/components/responses/ServerFail'
#!@author Nguyễn Tiến Tài
#!created_at 24/04/2023
#!description: Detail IndustryCode
/v1/admin/private/industry-code/detail/:industry_code_id:
get:
summary: Detail IndustryCode
tags: [Detail IndustryCode]
operationId: detailIndustryCode
parameters:
- $ref: '#/components/parameters/COOKIE-CLIENT'
- $ref: '#/components/parameters/X-DEVICE-ID'
- $ref: '#/components/parameters/X-OS-TYPE'
- $ref: '#/components/parameters/X-OS-VERSION'
- $ref: '#/components/parameters/X-APP-VERSION'
- $ref: '#/components/parameters/X-DEVICE-NAME'
- $ref: '#/components/parameters/TOKEN'
responses:
200:
description: Detail success
content:
application/json:
schema:
type: object
properties:
status:
type: integer
example: 200
message:
type: string
example: Success
503:
$ref: '#/components/responses/ServerFail'
#!@author Nguyễn Tiến Tài
#!created_at 24/04/2023
#!description: Get all IndustryCode
/v1/admin/private/industry-code/all:
get:
summary: Get all IndustryCode
tags: [Get all IndustryCode]
operationId: getAllIndustryCode
parameters:
- $ref: '#/components/parameters/COOKIE-CLIENT'
- $ref: '#/components/parameters/X-DEVICE-ID'
- $ref: '#/components/parameters/X-OS-TYPE'
- $ref: '#/components/parameters/X-OS-VERSION'
- $ref: '#/components/parameters/X-APP-VERSION'
- $ref: '#/components/parameters/X-DEVICE-NAME'
- $ref: '#/components/parameters/TOKEN'
responses:
200:
description: success
content:
application/json:
schema:
type: object
properties:
status:
type: integer
example: 200
message:
type: string
example: Success
503:
$ref: '#/components/responses/ServerFail'
Loading

0 comments on commit 96c06ab

Please sign in to comment.