update user, auth, token, roles, done
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
const swaggerAutogen = require('swagger-autogen')();
|
||||
const swaggerAutogen = require('swagger-autogen')({ openapi: '3.0.0' });
|
||||
const config = require('config');
|
||||
|
||||
const doc = {
|
||||
@ -8,6 +8,14 @@ const doc = {
|
||||
version: config.get('app.version')
|
||||
},
|
||||
host: config.get('server.host_swagger') + ':' + config.get('server.port'),
|
||||
components: {
|
||||
securitySchemes: {
|
||||
bearerAuth: {
|
||||
type: 'http',
|
||||
scheme: 'bearer'
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const outputFile = './swagger.json';
|
||||
|
||||
@ -1,48 +1,61 @@
|
||||
{
|
||||
"swagger": "2.0",
|
||||
"openapi": "3.0.0",
|
||||
"info": {
|
||||
"title": "Service Name",
|
||||
"description": "Description of service",
|
||||
"version": "1.0.0"
|
||||
},
|
||||
"host": "127.0.0.1:4001",
|
||||
"basePath": "/",
|
||||
"schemes": [
|
||||
"http"
|
||||
"servers": [
|
||||
{
|
||||
"url": "http://127.0.0.1:4001/"
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"/api/user/list": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"User"
|
||||
],
|
||||
"description": "",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "filter",
|
||||
"in": "query",
|
||||
"type": "string"
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "limit",
|
||||
"in": "query",
|
||||
"required": true,
|
||||
"type": "number"
|
||||
"schema": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "page",
|
||||
"in": "query",
|
||||
"required": true,
|
||||
"type": "number"
|
||||
"schema": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "with_deleted",
|
||||
"in": "query",
|
||||
"required": true,
|
||||
"type": "boolean"
|
||||
"schema": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "order_field",
|
||||
"in": "query",
|
||||
"required": true,
|
||||
"type": "string"
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "order_direction",
|
||||
@ -52,18 +65,28 @@
|
||||
"ASC",
|
||||
"DESC"
|
||||
],
|
||||
"type": "string"
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"default": {
|
||||
"description": ""
|
||||
}
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"bearerAuth": []
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/user/create": {
|
||||
"post": {
|
||||
"tags": [
|
||||
"User"
|
||||
],
|
||||
"description": "",
|
||||
"parameters": [
|
||||
{
|
||||
@ -94,9 +117,9 @@
|
||||
"type": "string",
|
||||
"example": "Administrator"
|
||||
},
|
||||
"role": {
|
||||
"id_role": {
|
||||
"type": "string",
|
||||
"example": "ADMINISTRATOR"
|
||||
"example": "4a6991b6-78a0-4b3b-bf5c-fa0af5f69be8"
|
||||
},
|
||||
"status": {
|
||||
"type": "string",
|
||||
@ -110,79 +133,260 @@
|
||||
"default": {
|
||||
"description": ""
|
||||
}
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"bearerAuth": []
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/user/update/{id}": {
|
||||
"put": {
|
||||
"tags": [
|
||||
"User"
|
||||
],
|
||||
"description": "",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"type": "uuid",
|
||||
"description": "User ID."
|
||||
},
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"description": "User data",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"email": {
|
||||
"type": "string",
|
||||
"example": "admin@gmail.com"
|
||||
},
|
||||
"username": {
|
||||
"type": "string",
|
||||
"example": "admin"
|
||||
},
|
||||
"password": {
|
||||
"type": "string",
|
||||
"example": "123456"
|
||||
},
|
||||
"retype_password": {
|
||||
"type": "string",
|
||||
"example": "123456"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"example": "Administrator"
|
||||
},
|
||||
"role": {
|
||||
"type": "string",
|
||||
"example": "ADMINISTRATOR"
|
||||
},
|
||||
"status": {
|
||||
"type": "string",
|
||||
"example": "Y"
|
||||
}
|
||||
}
|
||||
}
|
||||
"type": "string"
|
||||
},
|
||||
"description": "User ID."
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"default": {
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"bearerAuth": []
|
||||
}
|
||||
],
|
||||
"requestBody": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"example": "any"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/user/update_profile/{id}": {
|
||||
"put": {
|
||||
"tags": [
|
||||
"User"
|
||||
],
|
||||
"description": "",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": "User ID."
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"default": {
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"bearerAuth": []
|
||||
}
|
||||
],
|
||||
"requestBody": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"example": "any"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/user/update_password/{id}": {
|
||||
"put": {
|
||||
"tags": [
|
||||
"User"
|
||||
],
|
||||
"description": "",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": "User ID."
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"default": {
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"bearerAuth": []
|
||||
}
|
||||
],
|
||||
"requestBody": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"example": "any"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/user/delete/{id}": {
|
||||
"delete": {
|
||||
"tags": [
|
||||
"User"
|
||||
],
|
||||
"description": "",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"type": "uuid",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": "User ID."
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"default": {
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"bearerAuth": []
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/user/restore/{id}": {
|
||||
"put": {
|
||||
"tags": [
|
||||
"User"
|
||||
],
|
||||
"description": "",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": "User ID."
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"default": {
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"security": [
|
||||
{
|
||||
"bearerAuth": []
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"/api/user_role/list": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"User Roles"
|
||||
],
|
||||
"description": "",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "filter",
|
||||
"in": "query",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "limit",
|
||||
"in": "query",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "page",
|
||||
"in": "query",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "with_deleted",
|
||||
"in": "query",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "order_field",
|
||||
"in": "query",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "order_direction",
|
||||
"in": "query",
|
||||
"required": true,
|
||||
"enum": [
|
||||
"ASC",
|
||||
"DESC"
|
||||
],
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"default": {
|
||||
"description": ""
|
||||
@ -190,16 +394,410 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/user/restore/{id}": {
|
||||
"/api/user_role/create": {
|
||||
"post": {
|
||||
"tags": [
|
||||
"User Roles"
|
||||
],
|
||||
"description": "",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"description": "User role data",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"example": "Administrator"
|
||||
},
|
||||
"roles": {
|
||||
"type": "array",
|
||||
"example": [
|
||||
"dashboard"
|
||||
],
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"status": {
|
||||
"type": "string",
|
||||
"example": "Y"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"default": {
|
||||
"description": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/user_role/update/{id}": {
|
||||
"put": {
|
||||
"tags": [
|
||||
"User Roles"
|
||||
],
|
||||
"description": "",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"type": "uuid",
|
||||
"description": "User ID."
|
||||
"schema": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": "User role ID."
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"default": {
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"requestBody": {
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"example": "any"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/user_role/delete/{id}": {
|
||||
"delete": {
|
||||
"tags": [
|
||||
"User Roles"
|
||||
],
|
||||
"description": "",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": "User role ID."
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"default": {
|
||||
"description": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/user_role/restore/{id}": {
|
||||
"put": {
|
||||
"tags": [
|
||||
"User Roles"
|
||||
],
|
||||
"description": "",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "id",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": "User role ID."
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"default": {
|
||||
"description": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/user_activity": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"User Activity"
|
||||
],
|
||||
"description": "",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "filter",
|
||||
"in": "query",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "limit",
|
||||
"in": "query",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "page",
|
||||
"in": "query",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "with_deleted",
|
||||
"in": "query",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "order_field",
|
||||
"in": "query",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "order_direction",
|
||||
"in": "query",
|
||||
"required": true,
|
||||
"enum": [
|
||||
"ASC",
|
||||
"DESC"
|
||||
],
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"default": {
|
||||
"description": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/user_activity/create": {
|
||||
"post": {
|
||||
"tags": [
|
||||
"User Activity"
|
||||
],
|
||||
"description": "",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"description": "User Activity data",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id_user": {
|
||||
"type": "string",
|
||||
"example": "4a6991b6-78a0-4b3b-bf5c-fa0af5f69be8"
|
||||
},
|
||||
"refresh_token": {
|
||||
"type": "string",
|
||||
"example": "1a1221b6-78a0-4b3b-bf5c-fa0af5f69be8"
|
||||
},
|
||||
"module": {
|
||||
"type": "string",
|
||||
"example": "dashboard"
|
||||
},
|
||||
"description": {
|
||||
"type": "string",
|
||||
"example": "Main Dashboard"
|
||||
},
|
||||
"action": {
|
||||
"type": "string",
|
||||
"example": "V"
|
||||
},
|
||||
"url": {
|
||||
"type": "string",
|
||||
"example": "https://bri-dev.shiblysolution.id/"
|
||||
},
|
||||
"data_body": {
|
||||
"type": "string",
|
||||
"example": "{'from':'2024-11-01','to':'2024-11-26'}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"default": {
|
||||
"description": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/refresh_token/list": {
|
||||
"get": {
|
||||
"tags": [
|
||||
"User Refresh Token"
|
||||
],
|
||||
"description": "",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "filter",
|
||||
"in": "query",
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "limit",
|
||||
"in": "query",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "page",
|
||||
"in": "query",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "order_field",
|
||||
"in": "query",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "order_direction",
|
||||
"in": "query",
|
||||
"required": true,
|
||||
"enum": [
|
||||
"ASC",
|
||||
"DESC"
|
||||
],
|
||||
"schema": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"default": {
|
||||
"description": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/refresh_token/force_logout/{refresh_token}": {
|
||||
"put": {
|
||||
"tags": [
|
||||
"User Refresh Token"
|
||||
],
|
||||
"description": "",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "refresh_token",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": "Refresh Token."
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"default": {
|
||||
"description": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/login": {
|
||||
"post": {
|
||||
"tags": [
|
||||
"Auth"
|
||||
],
|
||||
"description": "",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "body",
|
||||
"in": "body",
|
||||
"description": "Login data",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"username": {
|
||||
"type": "string",
|
||||
"example": "admin"
|
||||
},
|
||||
"password": {
|
||||
"type": "string",
|
||||
"example": "123456"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"default": {
|
||||
"description": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/logout/{refresh_token}": {
|
||||
"put": {
|
||||
"tags": [
|
||||
"Auth"
|
||||
],
|
||||
"description": "",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "refresh_token",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": "Refresh Token"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"default": {
|
||||
"description": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/api/renew_token/{refresh_token}": {
|
||||
"put": {
|
||||
"tags": [
|
||||
"Auth"
|
||||
],
|
||||
"description": "",
|
||||
"parameters": [
|
||||
{
|
||||
"name": "refresh_token",
|
||||
"in": "path",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string"
|
||||
},
|
||||
"description": "Refresh Token"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
@ -209,5 +807,13 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"components": {
|
||||
"securitySchemes": {
|
||||
"bearerAuth": {
|
||||
"type": "http",
|
||||
"scheme": "bearer"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user