import fix
This commit is contained in:
parent
2a606acf6a
commit
e30a3bf3c1
|
|
@ -2,7 +2,6 @@
|
||||||
* @fileoverview This file contains the route definitions for the user-related endpoints.
|
* @fileoverview This file contains the route definitions for the user-related endpoints.
|
||||||
*/
|
*/
|
||||||
import {Router, text} from 'express'
|
import {Router, text} from 'express'
|
||||||
import { getDeviceController, getDeviceByUuidController, postDeviceController, putDeviceController, deleteDeviceController} from '../controllers/resource_types/deviceController.js'
|
|
||||||
import { getUserListController, getUserInfoController, postUserController, putUserController, softDeleteUserController } from '../controllers/authorization/userController.js'
|
import { getUserListController, getUserInfoController, postUserController, putUserController, softDeleteUserController } from '../controllers/authorization/userController.js'
|
||||||
import { getRoleController, getRoleInfoController, postRoleController, putRoleController, deleteRoleController } from '../controllers/authorization/rolesController.js'
|
import { getRoleController, getRoleInfoController, postRoleController, putRoleController, deleteRoleController } from '../controllers/authorization/rolesController.js'
|
||||||
import { getPermissionController, getPermissionByUuidController, postPermissionController, putPermissionController, softDeletePermissionController } from '../controllers/authorization/permissionsController.js'
|
import { getPermissionController, getPermissionByUuidController, postPermissionController, putPermissionController, softDeletePermissionController } from '../controllers/authorization/permissionsController.js'
|
||||||
|
|
@ -36,12 +35,7 @@ import {
|
||||||
putRolesHasPermissionsController,
|
putRolesHasPermissionsController,
|
||||||
softDeleteRolesHasPermissionsController,
|
softDeleteRolesHasPermissionsController,
|
||||||
} from '../controllers/authorization/roles_has_permissionsController.js'
|
} from '../controllers/authorization/roles_has_permissionsController.js'
|
||||||
import {
|
|
||||||
getUsersHasDevicesController,
|
|
||||||
postUsersHasDevicesController,
|
|
||||||
putUsersHasDevicesController,
|
|
||||||
softDeleteUsersHasDevicesController,
|
|
||||||
} from '../controllers/resource_types/usersHasDevicesController.js'
|
|
||||||
/**
|
/**
|
||||||
* @function default
|
* @function default
|
||||||
* @param {Object} configuration based on environment
|
* @param {Object} configuration based on environment
|
||||||
|
|
@ -66,7 +60,7 @@ export default(config) => {
|
||||||
* Express router to mount user related functions on.
|
* Express router to mount user related functions on.
|
||||||
* @type {Object}
|
* @type {Object}
|
||||||
* @const
|
* @const
|
||||||
* @namespace deviceRouter
|
* @namespace placeRouter
|
||||||
*/
|
*/
|
||||||
const routes = Router()
|
const routes = Router()
|
||||||
const hasAddLinks = config.environment !== 'production'
|
const hasAddLinks = config.environment !== 'production'
|
||||||
|
|
@ -77,7 +71,7 @@ export default(config) => {
|
||||||
* @name get/
|
* @name get/
|
||||||
* @function
|
* @function
|
||||||
* @inner
|
* @inner
|
||||||
* @memberof deviceRouter
|
* @memberof placeRouter
|
||||||
* @route GET /
|
* @route GET /
|
||||||
* @returns {Device} 200 - The data object with message
|
* @returns {Device} 200 - The data object with message
|
||||||
* @returns {ErrorResponse} 404 - Data not found
|
* @returns {ErrorResponse} 404 - Data not found
|
||||||
|
|
@ -95,7 +89,7 @@ export default(config) => {
|
||||||
* @name get/users
|
* @name get/users
|
||||||
* @function
|
* @function
|
||||||
* @inner
|
* @inner
|
||||||
* @memberof deviceRouter
|
* @memberof placeRouter
|
||||||
* @route GET /users
|
* @route GET /users
|
||||||
* @group Users - Operations about users
|
* @group Users - Operations about users
|
||||||
* @param {string} uuid.path.required - The unique identifier for the user
|
* @param {string} uuid.path.required - The unique identifier for the user
|
||||||
|
|
@ -126,7 +120,7 @@ export default(config) => {
|
||||||
* @name get/users/:uuid
|
* @name get/users/:uuid
|
||||||
* @function
|
* @function
|
||||||
* @inner
|
* @inner
|
||||||
* @memberof deviceRouter
|
* @memberof placeRouter
|
||||||
* @route GET /users/{uuid}
|
* @route GET /users/{uuid}
|
||||||
* @group Users - Operations about users
|
* @group Users - Operations about users
|
||||||
* @param {string} uuid.path.required - The unique identifier for the user
|
* @param {string} uuid.path.required - The unique identifier for the user
|
||||||
|
|
@ -156,7 +150,7 @@ export default(config) => {
|
||||||
* @name POST/users
|
* @name POST/users
|
||||||
* @function
|
* @function
|
||||||
* @inner
|
* @inner
|
||||||
* @memberof deviceRouter
|
* @memberof placeRouter
|
||||||
* @route POST /users
|
* @route POST /users
|
||||||
* @group Users - Operations about users
|
* @group Users - Operations about users
|
||||||
* @param {string} username.path.required - The username of the user
|
* @param {string} username.path.required - The username of the user
|
||||||
|
|
@ -192,7 +186,7 @@ export default(config) => {
|
||||||
* @name PUT/users/:uuid
|
* @name PUT/users/:uuid
|
||||||
* @function
|
* @function
|
||||||
* @inner
|
* @inner
|
||||||
* @memberof deviceRouter
|
* @memberof placeRouter
|
||||||
* @route PUT /users/{uuid}
|
* @route PUT /users/{uuid}
|
||||||
* @group Users - Operations about users
|
* @group Users - Operations about users
|
||||||
* @param {string} uuid.path.required - The unique identifier for the user
|
* @param {string} uuid.path.required - The unique identifier for the user
|
||||||
|
|
@ -228,7 +222,7 @@ export default(config) => {
|
||||||
* @name delete/users/:uuid
|
* @name delete/users/:uuid
|
||||||
* @function
|
* @function
|
||||||
* @inner
|
* @inner
|
||||||
* @memberof deviceRouter
|
* @memberof placeRouter
|
||||||
* @route DELETE /users/{uuid}
|
* @route DELETE /users/{uuid}
|
||||||
* @group Users - Operations about users
|
* @group Users - Operations about users
|
||||||
* @param {string} uuid.path.required - The unique identifier for the user
|
* @param {string} uuid.path.required - The unique identifier for the user
|
||||||
|
|
@ -255,7 +249,7 @@ export default(config) => {
|
||||||
* @name GET/roles
|
* @name GET/roles
|
||||||
* @function
|
* @function
|
||||||
* @inner
|
* @inner
|
||||||
* @memberof deviceRouter
|
* @memberof placeRouter
|
||||||
* @route GET /roles
|
* @route GET /roles
|
||||||
* @group Roles - Operations about roles
|
* @group Roles - Operations about roles
|
||||||
* @param {string} uuid.path.required - The unique identifier for the role
|
* @param {string} uuid.path.required - The unique identifier for the role
|
||||||
|
|
@ -282,7 +276,7 @@ export default(config) => {
|
||||||
* @name GET/roles/:uuid
|
* @name GET/roles/:uuid
|
||||||
* @function
|
* @function
|
||||||
* @inner
|
* @inner
|
||||||
* @memberof deviceRouter
|
* @memberof placeRouter
|
||||||
* @route GET /roles/{uuid}
|
* @route GET /roles/{uuid}
|
||||||
* @group Roles - Operations about roles
|
* @group Roles - Operations about roles
|
||||||
* @param {string} uuid.path.required - The unique identifier for the role
|
* @param {string} uuid.path.required - The unique identifier for the role
|
||||||
|
|
@ -313,7 +307,7 @@ export default(config) => {
|
||||||
* @name POST/roles
|
* @name POST/roles
|
||||||
* @function
|
* @function
|
||||||
* @inner
|
* @inner
|
||||||
* @memberof deviceRouter
|
* @memberof placeRouter
|
||||||
* @route POST /roles
|
* @route POST /roles
|
||||||
* @group Roles - Operations about roles
|
* @group Roles - Operations about roles
|
||||||
* @param {string} name.path.required - The name of the role
|
* @param {string} name.path.required - The name of the role
|
||||||
|
|
@ -342,7 +336,7 @@ export default(config) => {
|
||||||
* @name PUT/roles/:uuid
|
* @name PUT/roles/:uuid
|
||||||
* @function
|
* @function
|
||||||
* @inner
|
* @inner
|
||||||
* @memberof deviceRouter
|
* @memberof placeRouter
|
||||||
* @route PUT /roles/{uuid}
|
* @route PUT /roles/{uuid}
|
||||||
* @group Roles - Operations about roles
|
* @group Roles - Operations about roles
|
||||||
* @param {string} uuid.path.required - The unique identifier for the role
|
* @param {string} uuid.path.required - The unique identifier for the role
|
||||||
|
|
@ -374,7 +368,7 @@ export default(config) => {
|
||||||
* @name DELETE/roles/:uuid
|
* @name DELETE/roles/:uuid
|
||||||
* @function
|
* @function
|
||||||
* @inner
|
* @inner
|
||||||
* @memberof deviceRouter
|
* @memberof placeRouter
|
||||||
* @route DELETE /roles/{uuid}
|
* @route DELETE /roles/{uuid}
|
||||||
* @group Roles - Operations about roles
|
* @group Roles - Operations about roles
|
||||||
* @param {string} uuid.path.required - The unique identifier for the role
|
* @param {string} uuid.path.required - The unique identifier for the role
|
||||||
|
|
@ -405,7 +399,7 @@ export default(config) => {
|
||||||
* @name GET/permissions
|
* @name GET/permissions
|
||||||
* @function
|
* @function
|
||||||
* @inner
|
* @inner
|
||||||
* @memberof deviceRouter
|
* @memberof placeRouter
|
||||||
* @route GET /permissions
|
* @route GET /permissions
|
||||||
* @group Permissions - Operations about permissions
|
* @group Permissions - Operations about permissions
|
||||||
* @param {string} uuid.path.required - The unique identifier for the permission
|
* @param {string} uuid.path.required - The unique identifier for the permission
|
||||||
|
|
@ -434,7 +428,7 @@ export default(config) => {
|
||||||
* @name GET/permissions/:uuid
|
* @name GET/permissions/:uuid
|
||||||
* @function
|
* @function
|
||||||
* @inner
|
* @inner
|
||||||
* @memberof deviceRouter
|
* @memberof placeRouter
|
||||||
* @route GET /permissions/{uuid}
|
* @route GET /permissions/{uuid}
|
||||||
* @group Permissions - Operations about permissions
|
* @group Permissions - Operations about permissions
|
||||||
* @param {string} uuid.path.required - The unique identifier for the permission
|
* @param {string} uuid.path.required - The unique identifier for the permission
|
||||||
|
|
@ -459,6 +453,22 @@ export default(config) => {
|
||||||
(result, req, res, _) => sendOkResponse(result, req, res)
|
(result, req, res, _) => sendOkResponse(result, req, res)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @name POST/permissions
|
||||||
|
* @function
|
||||||
|
* @inner
|
||||||
|
* @memberof placeRouter
|
||||||
|
* @route POST /permissions
|
||||||
|
* @group Permissions - Operations about permissions
|
||||||
|
* @param {string} name.path.required - The name of the permission
|
||||||
|
* @param {string} uuid.path.required - The unique identifier for the permission
|
||||||
|
* @returns {SuccessResponse} 200 - Permission created successfully
|
||||||
|
* @returns {ErrorResponse} 400 - Bad request
|
||||||
|
* @returns {ErrorResponse} 404 - Permission not found
|
||||||
|
* @returns {ErrorResponse} 422 - Unprocessable entity
|
||||||
|
* @returns {ErrorResponse} 500 - Internal server error
|
||||||
|
* @returns {ErrorResponse} 403 - Forbidden
|
||||||
|
*/
|
||||||
routes.post(
|
routes.post(
|
||||||
'/permissions',
|
'/permissions',
|
||||||
(req, res, next) => authenticateToken(req, res, next, config),
|
(req, res, next) => authenticateToken(req, res, next, config),
|
||||||
|
|
@ -476,7 +486,7 @@ export default(config) => {
|
||||||
* @name PUT/permissions/:uuid
|
* @name PUT/permissions/:uuid
|
||||||
* @function
|
* @function
|
||||||
* @inner
|
* @inner
|
||||||
* @memberof deviceRouter
|
* @memberof placeRouter
|
||||||
* @route PUT /permissions/{uuid}
|
* @route PUT /permissions/{uuid}
|
||||||
* @group Permissions - Operations about permissions
|
* @group Permissions - Operations about permissions
|
||||||
* @param {string} uuid.path.required - The unique identifier for the permission
|
* @param {string} uuid.path.required - The unique identifier for the permission
|
||||||
|
|
@ -509,7 +519,7 @@ export default(config) => {
|
||||||
* @name DELETE/permissions/:uuid
|
* @name DELETE/permissions/:uuid
|
||||||
* @function
|
* @function
|
||||||
* @inner
|
* @inner
|
||||||
* @memberof deviceRouter
|
* @memberof placeRouter
|
||||||
* @route DELETE /permissions/{uuid}
|
* @route DELETE /permissions/{uuid}
|
||||||
* @group Permissions - Operations about permissions
|
* @group Permissions - Operations about permissions
|
||||||
* @param {string} uuid.path.required - The unique identifier for the permission
|
* @param {string} uuid.path.required - The unique identifier for the permission
|
||||||
|
|
@ -539,7 +549,7 @@ export default(config) => {
|
||||||
* @name GET/endpoints
|
* @name GET/endpoints
|
||||||
* @function
|
* @function
|
||||||
* @inner
|
* @inner
|
||||||
* @memberof deviceRouter
|
* @memberof placeRouter
|
||||||
* @route GET /endpoints
|
* @route GET /endpoints
|
||||||
* @group Endpoints - Operations about endpoints
|
* @group Endpoints - Operations about endpoints
|
||||||
* @param {string} uuid.path.required - The unique identifier for the endpoint
|
* @param {string} uuid.path.required - The unique identifier for the endpoint
|
||||||
|
|
@ -569,7 +579,7 @@ export default(config) => {
|
||||||
* @name GET/endpoints/:uuid
|
* @name GET/endpoints/:uuid
|
||||||
* @function
|
* @function
|
||||||
* @inner
|
* @inner
|
||||||
* @memberof deviceRouter
|
* @memberof placeRouter
|
||||||
* @route GET /endpoints/{uuid}
|
* @route GET /endpoints/{uuid}
|
||||||
* @group Endpoints - Operations about endpoints
|
* @group Endpoints - Operations about endpoints
|
||||||
* @param {string} uuid.path.required - The unique identifier for the endpoint
|
* @param {string} uuid.path.required - The unique identifier for the endpoint
|
||||||
|
|
@ -599,7 +609,7 @@ export default(config) => {
|
||||||
* @name POST/endpoints
|
* @name POST/endpoints
|
||||||
* @function
|
* @function
|
||||||
* @inner
|
* @inner
|
||||||
* @memberof deviceRouter
|
* @memberof placeRouter
|
||||||
* @route POST /endpoints
|
* @route POST /endpoints
|
||||||
* @group Endpoints - Operations about endpoints
|
* @group Endpoints - Operations about endpoints
|
||||||
* @param {string} route.path.required - The name of the endpoint
|
* @param {string} route.path.required - The name of the endpoint
|
||||||
|
|
@ -627,7 +637,7 @@ export default(config) => {
|
||||||
* @name PUT/endpoints/:uuid
|
* @name PUT/endpoints/:uuid
|
||||||
* @function
|
* @function
|
||||||
* @inner
|
* @inner
|
||||||
* @memberof deviceRouter
|
* @memberof placeRouter
|
||||||
* @route PUT /endpoints/{uuid}
|
* @route PUT /endpoints/{uuid}
|
||||||
* @group Endpoints - Operations about endpoints
|
* @group Endpoints - Operations about endpoints
|
||||||
* @param {string} uuid.path.required - The unique identifier for the endpoint
|
* @param {string} uuid.path.required - The unique identifier for the endpoint
|
||||||
|
|
@ -657,7 +667,7 @@ export default(config) => {
|
||||||
* @name DELETE/endpoints/:uuid
|
* @name DELETE/endpoints/:uuid
|
||||||
* @function
|
* @function
|
||||||
* @inner
|
* @inner
|
||||||
* @memberof deviceRouter
|
* @memberof placeRouter
|
||||||
* @route DELETE /endpoints/{uuid}
|
* @route DELETE /endpoints/{uuid}
|
||||||
* @group Endpoints - Operations about endpoints
|
* @group Endpoints - Operations about endpoints
|
||||||
* @param {string} uuid.path.required - The unique identifier for the endpoint
|
* @param {string} uuid.path.required - The unique identifier for the endpoint
|
||||||
|
|
@ -686,7 +696,7 @@ export default(config) => {
|
||||||
* @name GET/roles_has_permissions
|
* @name GET/roles_has_permissions
|
||||||
* @function
|
* @function
|
||||||
* @inner
|
* @inner
|
||||||
* @memberof deviceRouter
|
* @memberof placeRouter
|
||||||
* @route GET /roles_has_permissions
|
* @route GET /roles_has_permissions
|
||||||
* @group Roles Permissions - Operations about roles permissions
|
* @group Roles Permissions - Operations about roles permissions
|
||||||
* @param {string} uuid.path.required - The unique identifier for the role permission
|
* @param {string} uuid.path.required - The unique identifier for the role permission
|
||||||
|
|
@ -717,7 +727,7 @@ export default(config) => {
|
||||||
* @name GET/roles_has_permissions/:uuid
|
* @name GET/roles_has_permissions/:uuid
|
||||||
* @function
|
* @function
|
||||||
* @inner
|
* @inner
|
||||||
* @memberof deviceRouter
|
* @memberof placeRouter
|
||||||
* @route GET /roles_has_permissions/{uuid}
|
* @route GET /roles_has_permissions/{uuid}
|
||||||
* @group Roles Permissions - Operations about roles permissions
|
* @group Roles Permissions - Operations about roles permissions
|
||||||
* @param {string} uuid.path.required - The unique identifier for the role permission
|
* @param {string} uuid.path.required - The unique identifier for the role permission
|
||||||
|
|
@ -748,7 +758,7 @@ export default(config) => {
|
||||||
* @name POST/roles_has_permissions
|
* @name POST/roles_has_permissions
|
||||||
* @function
|
* @function
|
||||||
* @inner
|
* @inner
|
||||||
* @memberof deviceRouter
|
* @memberof placeRouter
|
||||||
* @route POST /roles_has_permissions
|
* @route POST /roles_has_permissions
|
||||||
* @group Roles Permissions - Operations about roles permissions
|
* @group Roles Permissions - Operations about roles permissions
|
||||||
* @param {string} fk_role.path.required - The unique identifier for the role
|
* @param {string} fk_role.path.required - The unique identifier for the role
|
||||||
|
|
@ -778,7 +788,7 @@ export default(config) => {
|
||||||
* @name PUT/roles_has_permissions/:uuid
|
* @name PUT/roles_has_permissions/:uuid
|
||||||
* @function
|
* @function
|
||||||
* @inner
|
* @inner
|
||||||
* @memberof deviceRouter
|
* @memberof placeRouter
|
||||||
* @route PUT /roles_has_permissions/{uuid}
|
* @route PUT /roles_has_permissions/{uuid}
|
||||||
* @group Roles Permissions - Operations about roles permissions
|
* @group Roles Permissions - Operations about roles permissions
|
||||||
* @param {string} uuid.path.required - The unique identifier for the role permission
|
* @param {string} uuid.path.required - The unique identifier for the role permission
|
||||||
|
|
@ -810,7 +820,7 @@ export default(config) => {
|
||||||
* @name DELETE/roles_has_permissions/:uuid
|
* @name DELETE/roles_has_permissions/:uuid
|
||||||
* @function
|
* @function
|
||||||
* @inner
|
* @inner
|
||||||
* @memberof deviceRouter
|
* @memberof placeRouter
|
||||||
* @route DELETE /roles_has_permissions/{uuid}
|
* @route DELETE /roles_has_permissions/{uuid}
|
||||||
* @group Roles Permissions - Operations about roles permissions
|
* @group Roles Permissions - Operations about roles permissions
|
||||||
* @param {string} uuid.path.required - The unique identifier for the role permission
|
* @param {string} uuid.path.required - The unique identifier for the role permission
|
||||||
|
|
@ -841,7 +851,7 @@ export default(config) => {
|
||||||
* @name POST/login
|
* @name POST/login
|
||||||
* @function
|
* @function
|
||||||
* @inner
|
* @inner
|
||||||
* @memberof deviceRouter
|
* @memberof placeRouter
|
||||||
* @route POST /login
|
* @route POST /login
|
||||||
* @group Login - Operations about login
|
* @group Login - Operations about login
|
||||||
* @param {string} username.path.required - The username of the user
|
* @param {string} username.path.required - The username of the user
|
||||||
|
|
@ -870,7 +880,7 @@ export default(config) => {
|
||||||
* @name POST/refresh_token
|
* @name POST/refresh_token
|
||||||
* @function
|
* @function
|
||||||
* @inner
|
* @inner
|
||||||
* @memberof deviceRouter
|
* @memberof placeRouter
|
||||||
* @route POST /refresh_token
|
* @route POST /refresh_token
|
||||||
* @group Login - Operations about login
|
* @group Login - Operations about login
|
||||||
* @param {string} refresh_token.path.required - The refresh token of the user
|
* @param {string} refresh_token.path.required - The refresh token of the user
|
||||||
|
|
@ -897,7 +907,7 @@ export default(config) => {
|
||||||
* @name POST/signin
|
* @name POST/signin
|
||||||
* @function
|
* @function
|
||||||
* @inner
|
* @inner
|
||||||
* @memberof deviceRouter
|
* @memberof placeRouter
|
||||||
* @route POST /signin
|
* @route POST /signin
|
||||||
* @group Login - Operations about login
|
* @group Login - Operations about login
|
||||||
* @param {string} username.path.required - The username of the user
|
* @param {string} username.path.required - The username of the user
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue