token fixing, add nationality crud
This commit is contained in:
@ -17,6 +17,9 @@ export class AdministrativuController {
|
|||||||
static async list(req: Request, res: Response, next: NextFunction): Promise<Response> {
|
static async list(req: Request, res: Response, next: NextFunction): Promise<Response> {
|
||||||
/*
|
/*
|
||||||
#swagger.tags = ['Administrativu']
|
#swagger.tags = ['Administrativu']
|
||||||
|
#swagger.security = [{
|
||||||
|
"bearerAuth": []
|
||||||
|
}]
|
||||||
#swagger.parameters['filter'] = {
|
#swagger.parameters['filter'] = {
|
||||||
description: 'Filter with 2 format : <ul><li>Simple format use text plaint will filter eq:code or like %name%</li><li>Advance format using field existing {status:\'Y\', any:\'SAME AS PLAINT LOGIC\', etc...}</li></ul>',
|
description: 'Filter with 2 format : <ul><li>Simple format use text plaint will filter eq:code or like %name%</li><li>Advance format using field existing {status:\'Y\', any:\'SAME AS PLAINT LOGIC\', etc...}</li></ul>',
|
||||||
in: 'query',
|
in: 'query',
|
||||||
@ -49,11 +52,6 @@ export class AdministrativuController {
|
|||||||
'@enum': ['ASC', 'DESC']
|
'@enum': ['ASC', 'DESC']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#swagger.parameters['token'] = {
|
|
||||||
in: 'query',
|
|
||||||
required: true,
|
|
||||||
type: 'string'
|
|
||||||
}
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -64,7 +62,6 @@ export class AdministrativuController {
|
|||||||
with_deleted: Joi.bool().required().label('With Deleted'),
|
with_deleted: Joi.bool().required().label('With Deleted'),
|
||||||
order_field: Joi.string().required().label('Order Field'),
|
order_field: Joi.string().required().label('Order Field'),
|
||||||
order_direction: Joi.string().allow('asc', 'desc').required().label('Order Direction'),
|
order_direction: Joi.string().allow('asc', 'desc').required().label('Order Direction'),
|
||||||
token: Joi.string().required().label('Token'),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const param: Paging = await schema.validateAsync(req.query);
|
const param: Paging = await schema.validateAsync(req.query);
|
||||||
@ -109,6 +106,9 @@ export class AdministrativuController {
|
|||||||
static async export(req: Request, res: Response, next: NextFunction): Promise<void | Response> {
|
static async export(req: Request, res: Response, next: NextFunction): Promise<void | Response> {
|
||||||
/*
|
/*
|
||||||
#swagger.tags = ['Administrativu']
|
#swagger.tags = ['Administrativu']
|
||||||
|
#swagger.security = [{
|
||||||
|
"bearerAuth": []
|
||||||
|
}]
|
||||||
#swagger.parameters['filter'] = {
|
#swagger.parameters['filter'] = {
|
||||||
description: 'Filter with 2 format : <ul><li>Simple format use text plaint will filter eq:code or like %name%</li><li>Advance format using field existing {status:\'Y\', any:\'SAME AS PLAINT LOGIC\', etc...}</li></ul>',
|
description: 'Filter with 2 format : <ul><li>Simple format use text plaint will filter eq:code or like %name%</li><li>Advance format using field existing {status:\'Y\', any:\'SAME AS PLAINT LOGIC\', etc...}</li></ul>',
|
||||||
in: 'query',
|
in: 'query',
|
||||||
@ -130,11 +130,6 @@ export class AdministrativuController {
|
|||||||
'@enum': ['ASC', 'DESC']
|
'@enum': ['ASC', 'DESC']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#swagger.parameters['token'] = {
|
|
||||||
in: 'query',
|
|
||||||
required: true,
|
|
||||||
type: 'string'
|
|
||||||
}
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -142,7 +137,6 @@ export class AdministrativuController {
|
|||||||
filter: Joi.string().allow('').optional().label('Filter'),
|
filter: Joi.string().allow('').optional().label('Filter'),
|
||||||
order_field: Joi.string().required().label('Order Field'),
|
order_field: Joi.string().required().label('Order Field'),
|
||||||
order_direction: Joi.string().allow('asc', 'desc').required().label('Order Direction'),
|
order_direction: Joi.string().allow('asc', 'desc').required().label('Order Direction'),
|
||||||
token: Joi.string().required().label('Token'),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const param: Paging = await schema.validateAsync(req.query);
|
const param: Paging = await schema.validateAsync(req.query);
|
||||||
|
|||||||
@ -17,6 +17,9 @@ export class AldeiaController {
|
|||||||
static async list(req: Request, res: Response, next: NextFunction): Promise<Response> {
|
static async list(req: Request, res: Response, next: NextFunction): Promise<Response> {
|
||||||
/*
|
/*
|
||||||
#swagger.tags = ['Aldeia']
|
#swagger.tags = ['Aldeia']
|
||||||
|
#swagger.security = [{
|
||||||
|
"bearerAuth": []
|
||||||
|
}]
|
||||||
#swagger.parameters['filter'] = {
|
#swagger.parameters['filter'] = {
|
||||||
description: 'Filter with 2 format : <ul><li>Simple format use text plaint will filter eq:code or like %name%</li><li>Advance format using field existing {status:\'Y\', any:\'SAME AS PLAINT LOGIC\', etc...}</li></ul>',
|
description: 'Filter with 2 format : <ul><li>Simple format use text plaint will filter eq:code or like %name%</li><li>Advance format using field existing {status:\'Y\', any:\'SAME AS PLAINT LOGIC\', etc...}</li></ul>',
|
||||||
in: 'query',
|
in: 'query',
|
||||||
@ -49,11 +52,6 @@ export class AldeiaController {
|
|||||||
'@enum': ['ASC', 'DESC']
|
'@enum': ['ASC', 'DESC']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#swagger.parameters['token'] = {
|
|
||||||
in: 'query',
|
|
||||||
required: true,
|
|
||||||
type: 'string'
|
|
||||||
}
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -64,7 +62,6 @@ export class AldeiaController {
|
|||||||
with_deleted: Joi.bool().required().label('With Deleted'),
|
with_deleted: Joi.bool().required().label('With Deleted'),
|
||||||
order_field: Joi.string().required().label('Order Field'),
|
order_field: Joi.string().required().label('Order Field'),
|
||||||
order_direction: Joi.string().allow('asc', 'desc').required().label('Order Direction'),
|
order_direction: Joi.string().allow('asc', 'desc').required().label('Order Direction'),
|
||||||
token: Joi.string().required().label('Token'),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const param: Paging = await schema.validateAsync(req.query);
|
const param: Paging = await schema.validateAsync(req.query);
|
||||||
@ -109,6 +106,9 @@ export class AldeiaController {
|
|||||||
static async export(req: Request, res: Response, next: NextFunction): Promise<void | Response> {
|
static async export(req: Request, res: Response, next: NextFunction): Promise<void | Response> {
|
||||||
/*
|
/*
|
||||||
#swagger.tags = ['Aldeia']
|
#swagger.tags = ['Aldeia']
|
||||||
|
#swagger.security = [{
|
||||||
|
"bearerAuth": []
|
||||||
|
}]
|
||||||
#swagger.parameters['filter'] = {
|
#swagger.parameters['filter'] = {
|
||||||
description: 'Filter with 2 format : <ul><li>Simple format use text plaint will filter eq:code or like %name%</li><li>Advance format using field existing {status:\'Y\', any:\'SAME AS PLAINT LOGIC\', etc...}</li></ul>',
|
description: 'Filter with 2 format : <ul><li>Simple format use text plaint will filter eq:code or like %name%</li><li>Advance format using field existing {status:\'Y\', any:\'SAME AS PLAINT LOGIC\', etc...}</li></ul>',
|
||||||
in: 'query',
|
in: 'query',
|
||||||
@ -130,11 +130,6 @@ export class AldeiaController {
|
|||||||
'@enum': ['ASC', 'DESC']
|
'@enum': ['ASC', 'DESC']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#swagger.parameters['token'] = {
|
|
||||||
in: 'query',
|
|
||||||
required: true,
|
|
||||||
type: 'string'
|
|
||||||
}
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -142,7 +137,6 @@ export class AldeiaController {
|
|||||||
filter: Joi.string().allow('').optional().label('Filter'),
|
filter: Joi.string().allow('').optional().label('Filter'),
|
||||||
order_field: Joi.string().required().label('Order Field'),
|
order_field: Joi.string().required().label('Order Field'),
|
||||||
order_direction: Joi.string().allow('asc', 'desc').required().label('Order Direction'),
|
order_direction: Joi.string().allow('asc', 'desc').required().label('Order Direction'),
|
||||||
token: Joi.string().required().label('Token'),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const param: Paging = await schema.validateAsync(req.query);
|
const param: Paging = await schema.validateAsync(req.query);
|
||||||
|
|||||||
@ -24,6 +24,9 @@ export class ApplicationController {
|
|||||||
): Promise<Response> {
|
): Promise<Response> {
|
||||||
/*
|
/*
|
||||||
#swagger.tags = ['Application']
|
#swagger.tags = ['Application']
|
||||||
|
#swagger.security = [{
|
||||||
|
"bearerAuth": []
|
||||||
|
}]
|
||||||
#swagger.parameters['filter'] = {
|
#swagger.parameters['filter'] = {
|
||||||
description: 'Filter with 2 format : <ul><li>Simple format use text plaint will filter eq:code or like %name%</li><li>Advance format using field existing {status:\'Y\', any:\'SAME AS PLAINT LOGIC\', etc...}</li></ul>',
|
description: 'Filter with 2 format : <ul><li>Simple format use text plaint will filter eq:code or like %name%</li><li>Advance format using field existing {status:\'Y\', any:\'SAME AS PLAINT LOGIC\', etc...}</li></ul>',
|
||||||
in: 'query',
|
in: 'query',
|
||||||
@ -56,11 +59,6 @@ export class ApplicationController {
|
|||||||
'@enum': ['ASC', 'DESC']
|
'@enum': ['ASC', 'DESC']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#swagger.parameters['token'] = {
|
|
||||||
in: 'query',
|
|
||||||
required: true,
|
|
||||||
type: 'string'
|
|
||||||
}
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -74,7 +72,6 @@ export class ApplicationController {
|
|||||||
.allow("asc", "desc")
|
.allow("asc", "desc")
|
||||||
.required()
|
.required()
|
||||||
.label("Order Direction"),
|
.label("Order Direction"),
|
||||||
token: Joi.string().required().label("Token"),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const param: Paging = await schema.validateAsync(req.query);
|
const param: Paging = await schema.validateAsync(req.query);
|
||||||
@ -137,6 +134,9 @@ export class ApplicationController {
|
|||||||
): Promise<void | Response> {
|
): Promise<void | Response> {
|
||||||
/*
|
/*
|
||||||
#swagger.tags = ['Application']
|
#swagger.tags = ['Application']
|
||||||
|
#swagger.security = [{
|
||||||
|
"bearerAuth": []
|
||||||
|
}]
|
||||||
#swagger.parameters['filter'] = {
|
#swagger.parameters['filter'] = {
|
||||||
description: 'Filter with 2 format : <ul><li>Simple format use text plaint will filter eq:code or like %name%</li><li>Advance format using field existing {status:\'Y\', any:\'SAME AS PLAINT LOGIC\', etc...}</li></ul>',
|
description: 'Filter with 2 format : <ul><li>Simple format use text plaint will filter eq:code or like %name%</li><li>Advance format using field existing {status:\'Y\', any:\'SAME AS PLAINT LOGIC\', etc...}</li></ul>',
|
||||||
in: 'query',
|
in: 'query',
|
||||||
@ -158,11 +158,6 @@ export class ApplicationController {
|
|||||||
'@enum': ['ASC', 'DESC']
|
'@enum': ['ASC', 'DESC']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#swagger.parameters['token'] = {
|
|
||||||
in: 'query',
|
|
||||||
required: true,
|
|
||||||
type: 'string'
|
|
||||||
}
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -173,7 +168,6 @@ export class ApplicationController {
|
|||||||
.allow("asc", "desc")
|
.allow("asc", "desc")
|
||||||
.required()
|
.required()
|
||||||
.label("Order Direction"),
|
.label("Order Direction"),
|
||||||
token: Joi.string().required().label("Token"),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const param: Paging = await schema.validateAsync(req.query);
|
const param: Paging = await schema.validateAsync(req.query);
|
||||||
|
|||||||
@ -17,6 +17,9 @@ export class DistrictController {
|
|||||||
static async list(req: Request, res: Response, next: NextFunction): Promise<Response> {
|
static async list(req: Request, res: Response, next: NextFunction): Promise<Response> {
|
||||||
/*
|
/*
|
||||||
#swagger.tags = ['District']
|
#swagger.tags = ['District']
|
||||||
|
#swagger.security = [{
|
||||||
|
"bearerAuth": []
|
||||||
|
}]
|
||||||
#swagger.parameters['filter'] = {
|
#swagger.parameters['filter'] = {
|
||||||
description: 'Filter with 2 format : <ul><li>Simple format use text plaint will filter eq:code or like %name%</li><li>Advance format using field existing {status:\'Y\', any:\'SAME AS PLAINT LOGIC\', etc...}</li></ul>',
|
description: 'Filter with 2 format : <ul><li>Simple format use text plaint will filter eq:code or like %name%</li><li>Advance format using field existing {status:\'Y\', any:\'SAME AS PLAINT LOGIC\', etc...}</li></ul>',
|
||||||
in: 'query',
|
in: 'query',
|
||||||
@ -49,11 +52,6 @@ export class DistrictController {
|
|||||||
'@enum': ['ASC', 'DESC']
|
'@enum': ['ASC', 'DESC']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#swagger.parameters['token'] = {
|
|
||||||
in: 'query',
|
|
||||||
required: true,
|
|
||||||
type: 'string'
|
|
||||||
}
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -64,7 +62,6 @@ export class DistrictController {
|
|||||||
with_deleted: Joi.bool().required().label('With Deleted'),
|
with_deleted: Joi.bool().required().label('With Deleted'),
|
||||||
order_field: Joi.string().required().label('Order Field'),
|
order_field: Joi.string().required().label('Order Field'),
|
||||||
order_direction: Joi.string().allow('asc', 'desc').required().label('Order Direction'),
|
order_direction: Joi.string().allow('asc', 'desc').required().label('Order Direction'),
|
||||||
token: Joi.string().required().label('Token'),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const param: Paging = await schema.validateAsync(req.query);
|
const param: Paging = await schema.validateAsync(req.query);
|
||||||
@ -109,6 +106,9 @@ export class DistrictController {
|
|||||||
static async export(req: Request, res: Response, next: NextFunction): Promise<void | Response> {
|
static async export(req: Request, res: Response, next: NextFunction): Promise<void | Response> {
|
||||||
/*
|
/*
|
||||||
#swagger.tags = ['District']
|
#swagger.tags = ['District']
|
||||||
|
#swagger.security = [{
|
||||||
|
"bearerAuth": []
|
||||||
|
}]
|
||||||
#swagger.parameters['filter'] = {
|
#swagger.parameters['filter'] = {
|
||||||
description: 'Filter with 2 format : <ul><li>Simple format use text plaint will filter eq:code or like %name%</li><li>Advance format using field existing {status:\'Y\', any:\'SAME AS PLAINT LOGIC\', etc...}</li></ul>',
|
description: 'Filter with 2 format : <ul><li>Simple format use text plaint will filter eq:code or like %name%</li><li>Advance format using field existing {status:\'Y\', any:\'SAME AS PLAINT LOGIC\', etc...}</li></ul>',
|
||||||
in: 'query',
|
in: 'query',
|
||||||
@ -130,11 +130,6 @@ export class DistrictController {
|
|||||||
'@enum': ['ASC', 'DESC']
|
'@enum': ['ASC', 'DESC']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#swagger.parameters['token'] = {
|
|
||||||
in: 'query',
|
|
||||||
required: true,
|
|
||||||
type: 'string'
|
|
||||||
}
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -142,7 +137,6 @@ export class DistrictController {
|
|||||||
filter: Joi.string().allow('').optional().label('Filter'),
|
filter: Joi.string().allow('').optional().label('Filter'),
|
||||||
order_field: Joi.string().required().label('Order Field'),
|
order_field: Joi.string().required().label('Order Field'),
|
||||||
order_direction: Joi.string().allow('asc', 'desc').required().label('Order Direction'),
|
order_direction: Joi.string().allow('asc', 'desc').required().label('Order Direction'),
|
||||||
token: Joi.string().required().label('Token'),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const param: Paging = await schema.validateAsync(req.query);
|
const param: Paging = await schema.validateAsync(req.query);
|
||||||
|
|||||||
@ -17,6 +17,9 @@ export class MenuController {
|
|||||||
static async list(req: Request, res: Response, next: NextFunction): Promise<Response> {
|
static async list(req: Request, res: Response, next: NextFunction): Promise<Response> {
|
||||||
/*
|
/*
|
||||||
#swagger.tags = ['Menu']
|
#swagger.tags = ['Menu']
|
||||||
|
#swagger.security = [{
|
||||||
|
"bearerAuth": []
|
||||||
|
}]
|
||||||
#swagger.parameters['filter'] = {
|
#swagger.parameters['filter'] = {
|
||||||
description: 'Filter with 2 format : <ul><li>Simple format use text plaint will filter like %name%</li><li>Advance format using field existing {status:\'Y\', any:\'SAME AS PLAINT LOGIC\', etc...}</li></ul>',
|
description: 'Filter with 2 format : <ul><li>Simple format use text plaint will filter like %name%</li><li>Advance format using field existing {status:\'Y\', any:\'SAME AS PLAINT LOGIC\', etc...}</li></ul>',
|
||||||
in: 'query',
|
in: 'query',
|
||||||
@ -49,11 +52,6 @@ export class MenuController {
|
|||||||
'@enum': ['ASC', 'DESC']
|
'@enum': ['ASC', 'DESC']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#swagger.parameters['token'] = {
|
|
||||||
in: 'query',
|
|
||||||
required: true,
|
|
||||||
type: 'string'
|
|
||||||
}
|
|
||||||
*/
|
*/
|
||||||
try {
|
try {
|
||||||
const schema = Joi.object().keys({
|
const schema = Joi.object().keys({
|
||||||
@ -63,7 +61,6 @@ export class MenuController {
|
|||||||
with_deleted: Joi.bool().required().label('With Deleted'),
|
with_deleted: Joi.bool().required().label('With Deleted'),
|
||||||
order_field: Joi.string().required().label('Order Field'),
|
order_field: Joi.string().required().label('Order Field'),
|
||||||
order_direction: Joi.string().allow('asc', 'desc').required().label('Order Direction'),
|
order_direction: Joi.string().allow('asc', 'desc').required().label('Order Direction'),
|
||||||
token: Joi.string().required().label('Token'),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const param: Paging = await schema.validateAsync(req.query);
|
const param: Paging = await schema.validateAsync(req.query);
|
||||||
@ -157,6 +154,9 @@ export class MenuController {
|
|||||||
static async export(req: Request, res: Response, next: NextFunction): Promise<void | Response> {
|
static async export(req: Request, res: Response, next: NextFunction): Promise<void | Response> {
|
||||||
/*
|
/*
|
||||||
#swagger.tags = ['Menu']
|
#swagger.tags = ['Menu']
|
||||||
|
#swagger.security = [{
|
||||||
|
"bearerAuth": []
|
||||||
|
}]
|
||||||
#swagger.parameters['filter'] = {
|
#swagger.parameters['filter'] = {
|
||||||
description: 'Filter with 2 format : <ul><li>Simple format use text plaint will filter like %name%</li><li>Advance format using field existing {status:\'Y\', any:\'SAME AS PLAINT LOGIC\', etc...}</li></ul>',
|
description: 'Filter with 2 format : <ul><li>Simple format use text plaint will filter like %name%</li><li>Advance format using field existing {status:\'Y\', any:\'SAME AS PLAINT LOGIC\', etc...}</li></ul>',
|
||||||
in: 'query',
|
in: 'query',
|
||||||
@ -178,11 +178,6 @@ export class MenuController {
|
|||||||
'@enum': ['ASC', 'DESC']
|
'@enum': ['ASC', 'DESC']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#swagger.parameters['token'] = {
|
|
||||||
in: 'query',
|
|
||||||
required: true,
|
|
||||||
type: 'string'
|
|
||||||
}
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -190,7 +185,6 @@ export class MenuController {
|
|||||||
filter: Joi.string().allow('').optional().label('Filter'),
|
filter: Joi.string().allow('').optional().label('Filter'),
|
||||||
order_field: Joi.string().required().label('Order Field'),
|
order_field: Joi.string().required().label('Order Field'),
|
||||||
order_direction: Joi.string().allow('asc', 'desc').required().label('Order Direction'),
|
order_direction: Joi.string().allow('asc', 'desc').required().label('Order Direction'),
|
||||||
token: Joi.string().required().label('Token'),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const param: Paging = await schema.validateAsync(req.query);
|
const param: Paging = await schema.validateAsync(req.query);
|
||||||
|
|||||||
@ -17,6 +17,9 @@ export class MunisipoController {
|
|||||||
static async list(req: Request, res: Response, next: NextFunction): Promise<Response> {
|
static async list(req: Request, res: Response, next: NextFunction): Promise<Response> {
|
||||||
/*
|
/*
|
||||||
#swagger.tags = ['Munisipo']
|
#swagger.tags = ['Munisipo']
|
||||||
|
#swagger.security = [{
|
||||||
|
"bearerAuth": []
|
||||||
|
}]
|
||||||
#swagger.parameters['filter'] = {
|
#swagger.parameters['filter'] = {
|
||||||
description: 'Filter with 2 format : <ul><li>Simple format use text plaint will filter eq:code or like %name%</li><li>Advance format using field existing {status:\'Y\', any:\'SAME AS PLAINT LOGIC\', etc...}</li></ul>',
|
description: 'Filter with 2 format : <ul><li>Simple format use text plaint will filter eq:code or like %name%</li><li>Advance format using field existing {status:\'Y\', any:\'SAME AS PLAINT LOGIC\', etc...}</li></ul>',
|
||||||
in: 'query',
|
in: 'query',
|
||||||
@ -49,11 +52,6 @@ export class MunisipoController {
|
|||||||
'@enum': ['ASC', 'DESC']
|
'@enum': ['ASC', 'DESC']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#swagger.parameters['token'] = {
|
|
||||||
in: 'query',
|
|
||||||
required: true,
|
|
||||||
type: 'string'
|
|
||||||
}
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -64,7 +62,6 @@ export class MunisipoController {
|
|||||||
with_deleted: Joi.bool().required().label('With Deleted'),
|
with_deleted: Joi.bool().required().label('With Deleted'),
|
||||||
order_field: Joi.string().required().label('Order Field'),
|
order_field: Joi.string().required().label('Order Field'),
|
||||||
order_direction: Joi.string().allow('asc', 'desc').required().label('Order Direction'),
|
order_direction: Joi.string().allow('asc', 'desc').required().label('Order Direction'),
|
||||||
token: Joi.string().required().label('Token'),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const param: Paging = await schema.validateAsync(req.query);
|
const param: Paging = await schema.validateAsync(req.query);
|
||||||
@ -109,6 +106,9 @@ export class MunisipoController {
|
|||||||
static async export(req: Request, res: Response, next: NextFunction): Promise<void | Response> {
|
static async export(req: Request, res: Response, next: NextFunction): Promise<void | Response> {
|
||||||
/*
|
/*
|
||||||
#swagger.tags = ['Munisipo']
|
#swagger.tags = ['Munisipo']
|
||||||
|
#swagger.security = [{
|
||||||
|
"bearerAuth": []
|
||||||
|
}]
|
||||||
#swagger.parameters['filter'] = {
|
#swagger.parameters['filter'] = {
|
||||||
description: 'Filter with 2 format : <ul><li>Simple format use text plaint will filter eq:code or like %name%</li><li>Advance format using field existing {status:\'Y\', any:\'SAME AS PLAINT LOGIC\', etc...}</li></ul>',
|
description: 'Filter with 2 format : <ul><li>Simple format use text plaint will filter eq:code or like %name%</li><li>Advance format using field existing {status:\'Y\', any:\'SAME AS PLAINT LOGIC\', etc...}</li></ul>',
|
||||||
in: 'query',
|
in: 'query',
|
||||||
@ -130,11 +130,6 @@ export class MunisipoController {
|
|||||||
'@enum': ['ASC', 'DESC']
|
'@enum': ['ASC', 'DESC']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#swagger.parameters['token'] = {
|
|
||||||
in: 'query',
|
|
||||||
required: true,
|
|
||||||
type: 'string'
|
|
||||||
}
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -142,7 +137,6 @@ export class MunisipoController {
|
|||||||
filter: Joi.string().allow('').optional().label('Filter'),
|
filter: Joi.string().allow('').optional().label('Filter'),
|
||||||
order_field: Joi.string().required().label('Order Field'),
|
order_field: Joi.string().required().label('Order Field'),
|
||||||
order_direction: Joi.string().allow('asc', 'desc').required().label('Order Direction'),
|
order_direction: Joi.string().allow('asc', 'desc').required().label('Order Direction'),
|
||||||
token: Joi.string().required().label('Token'),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const param: Paging = await schema.validateAsync(req.query);
|
const param: Paging = await schema.validateAsync(req.query);
|
||||||
|
|||||||
392
src/controllers/nationality.ts
Normal file
392
src/controllers/nationality.ts
Normal file
@ -0,0 +1,392 @@
|
|||||||
|
import { Response, NextFunction, Application } from "express";
|
||||||
|
import { Request } from "express-jwt";
|
||||||
|
import { ReturnHelper } from "../helpers/express/return";
|
||||||
|
import { OrmHelper } from "../helpers/orm";
|
||||||
|
import Joi from "joi";
|
||||||
|
import { ILogObj, Logger } from "tslog";
|
||||||
|
import { Language } from "../langs/lang";
|
||||||
|
import { Paging } from "entity";
|
||||||
|
import CommonHelper from "../helpers/common";
|
||||||
|
import * as fastcsv from 'fast-csv';
|
||||||
|
import dayjs from "dayjs";
|
||||||
|
import { Nationality } from "entity";
|
||||||
|
|
||||||
|
const log: Logger<ILogObj> = new Logger({ name: '[NationalityController]', type: 'pretty' });
|
||||||
|
|
||||||
|
export class NationalityController {
|
||||||
|
static async list(req: Request, res: Response, next: NextFunction): Promise<Response> {
|
||||||
|
/*
|
||||||
|
#swagger.tags = ['Nationality']
|
||||||
|
#swagger.security = [{
|
||||||
|
"bearerAuth": []
|
||||||
|
}]
|
||||||
|
#swagger.parameters['filter'] = {
|
||||||
|
description: 'Filter with 2 format : <ul><li>Simple format use text plaint will filter eq:code or like %name%</li><li>Advance format using field existing {status:\'Y\', any:\'SAME AS PLAINT LOGIC\', etc...}</li></ul>',
|
||||||
|
in: 'query',
|
||||||
|
type: 'string'
|
||||||
|
}
|
||||||
|
#swagger.parameters['limit'] = {
|
||||||
|
in: 'query',
|
||||||
|
required: true,
|
||||||
|
type: 'number'
|
||||||
|
}
|
||||||
|
#swagger.parameters['page'] = {
|
||||||
|
in: 'query',
|
||||||
|
required: true,
|
||||||
|
type: 'number'
|
||||||
|
}
|
||||||
|
#swagger.parameters['with_deleted'] = {
|
||||||
|
in: 'query',
|
||||||
|
required: true,
|
||||||
|
type: 'boolean'
|
||||||
|
}
|
||||||
|
#swagger.parameters['order_field'] = {
|
||||||
|
in: 'query',
|
||||||
|
required: true,
|
||||||
|
type: 'string'
|
||||||
|
}
|
||||||
|
#swagger.parameters['order_direction'] = {
|
||||||
|
in: 'query',
|
||||||
|
required: true,
|
||||||
|
schema: {
|
||||||
|
'@enum': ['ASC', 'DESC']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
try {
|
||||||
|
const schema = Joi.object().keys({
|
||||||
|
filter: Joi.string().allow('').optional().label('Filter'),
|
||||||
|
page: Joi.number().required().min(1).label('Page'),
|
||||||
|
limit: Joi.number().required().min(1).label('Limit'),
|
||||||
|
with_deleted: Joi.bool().required().label('With Deleted'),
|
||||||
|
order_field: Joi.string().required().label('Order Field'),
|
||||||
|
order_direction: Joi.string().allow('asc', 'desc').required().label('Order Direction'),
|
||||||
|
});
|
||||||
|
|
||||||
|
const param: Paging = await schema.validateAsync(req.query);
|
||||||
|
|
||||||
|
const repo = OrmHelper.DB.getRepository(Nationality);
|
||||||
|
|
||||||
|
const offset = (param.page - 1) * param.limit
|
||||||
|
|
||||||
|
const { whereAttr, whereVal } = CommonHelper.handleFilter({
|
||||||
|
filter: param.filter,
|
||||||
|
col_any_eq: ['code'],
|
||||||
|
col_any_like: ['name']
|
||||||
|
});
|
||||||
|
|
||||||
|
const res_count = repo.createQueryBuilder()
|
||||||
|
.where(whereAttr, whereVal);
|
||||||
|
const res_list = repo.createQueryBuilder()
|
||||||
|
.where(whereAttr, whereVal)
|
||||||
|
.orderBy(param.order_field, param.order_direction)
|
||||||
|
.offset(offset)
|
||||||
|
.limit(param.limit);
|
||||||
|
|
||||||
|
if (param.with_deleted) {
|
||||||
|
res_count.withDeleted();
|
||||||
|
res_list.withDeleted();
|
||||||
|
}
|
||||||
|
|
||||||
|
const current_page = param.page;
|
||||||
|
const total_count_data = await res_count.getCount();
|
||||||
|
const list_data = await res_list.getMany();
|
||||||
|
const count_data = CommonHelper.countObject(list_data);
|
||||||
|
|
||||||
|
return ReturnHelper.successResponselist(res, 200, Language.lang.success_view, count_data, current_page, total_count_data, list_data);
|
||||||
|
} catch (e: unknown) {
|
||||||
|
log.error(e);
|
||||||
|
const err = e as Error;
|
||||||
|
|
||||||
|
return ReturnHelper.errorResponse(res, 400, 401, Language.lang.failed_view, err.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static async export(req: Request, res: Response, next: NextFunction): Promise<void | Response> {
|
||||||
|
/*
|
||||||
|
#swagger.tags = ['Nationality']
|
||||||
|
#swagger.security = [{
|
||||||
|
"bearerAuth": []
|
||||||
|
}]
|
||||||
|
#swagger.parameters['filter'] = {
|
||||||
|
description: 'Filter with 2 format : <ul><li>Simple format use text plaint will filter eq:code or like %name%</li><li>Advance format using field existing {status:\'Y\', any:\'SAME AS PLAINT LOGIC\', etc...}</li></ul>',
|
||||||
|
in: 'query',
|
||||||
|
type: 'string'
|
||||||
|
}
|
||||||
|
#swagger.parameters['filter'] = {
|
||||||
|
in: 'query',
|
||||||
|
type: 'string'
|
||||||
|
}
|
||||||
|
#swagger.parameters['order_field'] = {
|
||||||
|
in: 'query',
|
||||||
|
required: true,
|
||||||
|
type: 'string'
|
||||||
|
}
|
||||||
|
#swagger.parameters['order_direction'] = {
|
||||||
|
in: 'query',
|
||||||
|
required: true,
|
||||||
|
schema: {
|
||||||
|
'@enum': ['ASC', 'DESC']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
try {
|
||||||
|
const schema = Joi.object().keys({
|
||||||
|
filter: Joi.string().allow('').optional().label('Filter'),
|
||||||
|
order_field: Joi.string().required().label('Order Field'),
|
||||||
|
order_direction: Joi.string().allow('asc', 'desc').required().label('Order Direction'),
|
||||||
|
});
|
||||||
|
|
||||||
|
const param: Paging = await schema.validateAsync(req.query);
|
||||||
|
|
||||||
|
const repo = OrmHelper.DB.getRepository(Nationality);
|
||||||
|
|
||||||
|
const { whereAttr, whereVal } = CommonHelper.handleFilter({
|
||||||
|
filter: param.filter,
|
||||||
|
col_any_eq: ['code'],
|
||||||
|
col_any_like: ['name']
|
||||||
|
});
|
||||||
|
|
||||||
|
const filename = "nationality.csv";
|
||||||
|
|
||||||
|
res.setHeader('Content-Type', 'text/csv');
|
||||||
|
res.setHeader('Content-Disposition', 'attachment; filename=' + filename);
|
||||||
|
|
||||||
|
const csvStream = fastcsv.format({
|
||||||
|
headers: true,
|
||||||
|
writeHeaders: true,
|
||||||
|
transform: (row: Nationality): any => ({
|
||||||
|
...row,
|
||||||
|
created_at: dayjs(row.created_at).format('DD-MM-YYYY HH:MM:ss'),
|
||||||
|
})
|
||||||
|
});
|
||||||
|
csvStream.pipe(res);
|
||||||
|
|
||||||
|
const limit = 50;
|
||||||
|
|
||||||
|
const fetchAndWrite = async (page: any) => {
|
||||||
|
const offset = (page - 1) * limit
|
||||||
|
|
||||||
|
const data = await repo.createQueryBuilder()
|
||||||
|
.where(whereAttr, whereVal)
|
||||||
|
.select([
|
||||||
|
'id',
|
||||||
|
'code',
|
||||||
|
'name',
|
||||||
|
'status',
|
||||||
|
'created_at'])
|
||||||
|
.orderBy(param.order_field, param.order_direction)
|
||||||
|
.offset(offset)
|
||||||
|
.limit(limit).getRawMany();
|
||||||
|
|
||||||
|
if (CommonHelper.countObject(data) === 0) {
|
||||||
|
csvStream.end();
|
||||||
|
} else {
|
||||||
|
data.forEach((item: any) => csvStream.write(item));
|
||||||
|
|
||||||
|
if (CommonHelper.countObject(data) == limit) {
|
||||||
|
fetchAndWrite(page + 1);
|
||||||
|
} else {
|
||||||
|
csvStream.end();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
fetchAndWrite(1);
|
||||||
|
} catch (e: unknown) {
|
||||||
|
log.error(e);
|
||||||
|
const err = e as Error;
|
||||||
|
|
||||||
|
return ReturnHelper.errorResponse(res, 400, 401, Language.lang.failed_view, err.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static async create(req: Request, res: Response, next: NextFunction): Promise<Response> {
|
||||||
|
/*
|
||||||
|
#swagger.tags = ['Nationality']
|
||||||
|
#swagger.security = [{
|
||||||
|
"bearerAuth": []
|
||||||
|
}]
|
||||||
|
|
||||||
|
#swagger.requestBody = {
|
||||||
|
required: true,
|
||||||
|
content: {
|
||||||
|
"application/json": {
|
||||||
|
schema: {
|
||||||
|
$ref: "#/components/schemas/nationality"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
try {
|
||||||
|
const schema = Joi.object().keys({
|
||||||
|
code: Joi.string().max(128).required().label('Code'),
|
||||||
|
name: Joi.string().max(256).required().label('Name'),
|
||||||
|
status: Joi.string().required().label('Status'),
|
||||||
|
});
|
||||||
|
|
||||||
|
const param: Nationality = await schema.validateAsync(req.body);
|
||||||
|
|
||||||
|
const data = new Nationality()
|
||||||
|
data.code = param.code
|
||||||
|
data.name = param.name
|
||||||
|
data.status = param.status
|
||||||
|
|
||||||
|
await OrmHelper.DB.manager.save(data);
|
||||||
|
|
||||||
|
return ReturnHelper.successResponseAny(res, 200, Language.lang.success_insert, data);
|
||||||
|
} catch (e: unknown) {
|
||||||
|
log.error(e);
|
||||||
|
const err = e as Error;
|
||||||
|
|
||||||
|
return ReturnHelper.errorResponse(res, 500, 401, Language.lang.failed_insert, err.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static async update(req: Request, res: Response, next: NextFunction): Promise<Response> {
|
||||||
|
/*
|
||||||
|
#swagger.tags = ['Nationality']
|
||||||
|
#swagger.security = [{
|
||||||
|
"bearerAuth": []
|
||||||
|
}]
|
||||||
|
#swagger.parameters['id'] = {
|
||||||
|
in: 'path',
|
||||||
|
description: 'Nationality ID.',
|
||||||
|
required: true,
|
||||||
|
type: 'string'
|
||||||
|
}
|
||||||
|
|
||||||
|
#swagger.requestBody = {
|
||||||
|
required: true,
|
||||||
|
content: {
|
||||||
|
"application/json": {
|
||||||
|
schema: {
|
||||||
|
$ref: "#/components/schemas/nationality"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
try {
|
||||||
|
const schema = Joi.object().keys({
|
||||||
|
id: Joi.string().uuid().required().label('ID'),
|
||||||
|
code: Joi.string().max(128).required().label('Code'),
|
||||||
|
name: Joi.string().max(256).required().label('Name'),
|
||||||
|
status: Joi.string().required().label('Status'),
|
||||||
|
});
|
||||||
|
|
||||||
|
req.body.id = req.params['id'];
|
||||||
|
|
||||||
|
const param: Nationality = await schema.validateAsync(req.body);
|
||||||
|
|
||||||
|
const repo = OrmHelper.DB.getRepository(Nationality);
|
||||||
|
|
||||||
|
const data = await repo.findOneBy({ id: param.id });
|
||||||
|
|
||||||
|
if (data != null) {
|
||||||
|
data.code = param.code
|
||||||
|
data.name = param.name
|
||||||
|
data.status = param.status
|
||||||
|
|
||||||
|
await repo.save(data);
|
||||||
|
|
||||||
|
return ReturnHelper.successResponseAny(res, 200, Language.lang.success_update, data);
|
||||||
|
} else {
|
||||||
|
return ReturnHelper.errorResponse(res, 404, 401, Language.lang.failed_not_found, "");
|
||||||
|
}
|
||||||
|
} catch (e: unknown) {
|
||||||
|
log.error(e);
|
||||||
|
const err = e as Error;
|
||||||
|
|
||||||
|
return ReturnHelper.errorResponse(res, 500, 402, Language.lang.failed_update, err.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static async delete(req: Request, res: Response, next: NextFunction): Promise<Response> {
|
||||||
|
/*
|
||||||
|
#swagger.tags = ['Nationality']
|
||||||
|
#swagger.security = [{
|
||||||
|
"bearerAuth": []
|
||||||
|
}]
|
||||||
|
#swagger.parameters['id'] = {
|
||||||
|
in: 'path',
|
||||||
|
description: 'Nationality ID.',
|
||||||
|
required: true,
|
||||||
|
type: 'string'
|
||||||
|
}
|
||||||
|
#swagger.parameters['hard'] = {
|
||||||
|
in: 'path',
|
||||||
|
description: 'Is Hard Delete',
|
||||||
|
required: false,
|
||||||
|
type: 'boolean'
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
try {
|
||||||
|
const schema = Joi.object().keys({
|
||||||
|
id: Joi.string().uuid().required().label('ID'),
|
||||||
|
hard: Joi.bool().optional().allow('').label('Is hard delete?')
|
||||||
|
});
|
||||||
|
|
||||||
|
const param: { id: string, hard: boolean } = await schema.validateAsync(req.params);
|
||||||
|
|
||||||
|
const repo = OrmHelper.DB.getRepository(Nationality);
|
||||||
|
|
||||||
|
const affected = (!param.hard ? await repo.softDelete({ id: param.id }) : await repo.delete({ id: param.id })).affected;
|
||||||
|
|
||||||
|
if (affected > 0) {
|
||||||
|
return ReturnHelper.successResponseAny(res, 200, Language.lang.success_delete, {});
|
||||||
|
} else {
|
||||||
|
return ReturnHelper.errorResponse(res, 404, 401, Language.lang.failed_not_found, "");
|
||||||
|
}
|
||||||
|
} catch (e: unknown) {
|
||||||
|
log.error(e);
|
||||||
|
const err = e as Error;
|
||||||
|
|
||||||
|
return ReturnHelper.errorResponse(res, 500, 402, Language.lang.failed_delete, err.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static async restore(req: Request, res: Response, next: NextFunction): Promise<Response> {
|
||||||
|
/*
|
||||||
|
#swagger.tags = ['Nationality']
|
||||||
|
#swagger.security = [{
|
||||||
|
"bearerAuth": []
|
||||||
|
}]
|
||||||
|
|
||||||
|
#swagger.parameters['id'] = {
|
||||||
|
in: 'path',
|
||||||
|
description: 'Nationality ID.',
|
||||||
|
required: true,
|
||||||
|
type: 'string'
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
try {
|
||||||
|
const schema = Joi.object().keys({
|
||||||
|
id: Joi.string().uuid().required().label('ID')
|
||||||
|
});
|
||||||
|
|
||||||
|
const param: Nationality = await schema.validateAsync(req.params);
|
||||||
|
|
||||||
|
const repo = OrmHelper.DB.getRepository(Nationality);
|
||||||
|
|
||||||
|
const affected = (await repo.restore({ id: param.id })).affected;
|
||||||
|
|
||||||
|
if (affected > 0) {
|
||||||
|
return ReturnHelper.successResponseAny(res, 200, Language.lang.success_restore, {});
|
||||||
|
} else {
|
||||||
|
return ReturnHelper.errorResponse(res, 404, 401, Language.lang.failed_not_found, "");
|
||||||
|
}
|
||||||
|
} catch (e: unknown) {
|
||||||
|
log.error(e);
|
||||||
|
const err = e as Error;
|
||||||
|
|
||||||
|
return ReturnHelper.errorResponse(res, 500, 402, Language.lang.failed_restore, err.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@ -17,6 +17,9 @@ export class SucoController {
|
|||||||
static async list(req: Request, res: Response, next: NextFunction): Promise<Response> {
|
static async list(req: Request, res: Response, next: NextFunction): Promise<Response> {
|
||||||
/*
|
/*
|
||||||
#swagger.tags = ['Suco']
|
#swagger.tags = ['Suco']
|
||||||
|
#swagger.security = [{
|
||||||
|
"bearerAuth": []
|
||||||
|
}]
|
||||||
#swagger.parameters['filter'] = {
|
#swagger.parameters['filter'] = {
|
||||||
description: 'Filter with 2 format : <ul><li>Simple format use text plaint will filter eq:code or like %name%</li><li>Advance format using field existing {status:\'Y\', any:\'SAME AS PLAINT LOGIC\', etc...}</li></ul>',
|
description: 'Filter with 2 format : <ul><li>Simple format use text plaint will filter eq:code or like %name%</li><li>Advance format using field existing {status:\'Y\', any:\'SAME AS PLAINT LOGIC\', etc...}</li></ul>',
|
||||||
in: 'query',
|
in: 'query',
|
||||||
@ -49,11 +52,6 @@ export class SucoController {
|
|||||||
'@enum': ['ASC', 'DESC']
|
'@enum': ['ASC', 'DESC']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#swagger.parameters['token'] = {
|
|
||||||
in: 'query',
|
|
||||||
required: true,
|
|
||||||
type: 'string'
|
|
||||||
}
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -64,7 +62,6 @@ export class SucoController {
|
|||||||
with_deleted: Joi.bool().required().label('With Deleted'),
|
with_deleted: Joi.bool().required().label('With Deleted'),
|
||||||
order_field: Joi.string().required().label('Order Field'),
|
order_field: Joi.string().required().label('Order Field'),
|
||||||
order_direction: Joi.string().allow('asc', 'desc').required().label('Order Direction'),
|
order_direction: Joi.string().allow('asc', 'desc').required().label('Order Direction'),
|
||||||
token: Joi.string().required().label('Token'),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const param: Paging = await schema.validateAsync(req.query);
|
const param: Paging = await schema.validateAsync(req.query);
|
||||||
@ -109,6 +106,9 @@ export class SucoController {
|
|||||||
static async export(req: Request, res: Response, next: NextFunction): Promise<void | Response> {
|
static async export(req: Request, res: Response, next: NextFunction): Promise<void | Response> {
|
||||||
/*
|
/*
|
||||||
#swagger.tags = ['Suco']
|
#swagger.tags = ['Suco']
|
||||||
|
#swagger.security = [{
|
||||||
|
"bearerAuth": []
|
||||||
|
}]
|
||||||
#swagger.parameters['filter'] = {
|
#swagger.parameters['filter'] = {
|
||||||
description: 'Filter with 2 format : <ul><li>Simple format use text plaint will filter eq:code or like %name%</li><li>Advance format using field existing {status:\'Y\', any:\'SAME AS PLAINT LOGIC\', etc...}</li></ul>',
|
description: 'Filter with 2 format : <ul><li>Simple format use text plaint will filter eq:code or like %name%</li><li>Advance format using field existing {status:\'Y\', any:\'SAME AS PLAINT LOGIC\', etc...}</li></ul>',
|
||||||
in: 'query',
|
in: 'query',
|
||||||
@ -130,11 +130,6 @@ export class SucoController {
|
|||||||
'@enum': ['ASC', 'DESC']
|
'@enum': ['ASC', 'DESC']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#swagger.parameters['token'] = {
|
|
||||||
in: 'query',
|
|
||||||
required: true,
|
|
||||||
type: 'string'
|
|
||||||
}
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -142,7 +137,6 @@ export class SucoController {
|
|||||||
filter: Joi.string().allow('').optional().label('Filter'),
|
filter: Joi.string().allow('').optional().label('Filter'),
|
||||||
order_field: Joi.string().required().label('Order Field'),
|
order_field: Joi.string().required().label('Order Field'),
|
||||||
order_direction: Joi.string().allow('asc', 'desc').required().label('Order Direction'),
|
order_direction: Joi.string().allow('asc', 'desc').required().label('Order Direction'),
|
||||||
token: Joi.string().required().label('Token'),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const param: Paging = await schema.validateAsync(req.query);
|
const param: Paging = await schema.validateAsync(req.query);
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import config from 'config';
|
import config from 'config';
|
||||||
import { DataSource } from "typeorm";
|
import { DataSource } from "typeorm";
|
||||||
import { ILogObj, Logger } from 'tslog';
|
import { ILogObj, Logger } from 'tslog';
|
||||||
import { Administrativu, Aldeia, District, Menu, Munisipo, Suco, Application } from 'entity'
|
import { Administrativu, Aldeia, District, Menu, Munisipo, Suco, Application, Nationality } from 'entity'
|
||||||
|
|
||||||
export class OrmHelper {
|
export class OrmHelper {
|
||||||
static DB: DataSource = null
|
static DB: DataSource = null
|
||||||
@ -20,7 +20,7 @@ export class OrmHelper {
|
|||||||
database: String(config.get("database.database")),
|
database: String(config.get("database.database")),
|
||||||
synchronize: true,
|
synchronize: true,
|
||||||
logging: config.get('database.logging'),
|
logging: config.get('database.logging'),
|
||||||
entities: [Menu, Administrativu, Aldeia, District, Munisipo, Suco, Application],
|
entities: [Menu, Administrativu, Aldeia, District, Munisipo, Suco, Application, Nationality],
|
||||||
subscribers: [],
|
subscribers: [],
|
||||||
migrations: [],
|
migrations: [],
|
||||||
})
|
})
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import { DistrictController } from '../controllers/district';
|
|||||||
import { MunisipoController } from '../controllers/munisipo';
|
import { MunisipoController } from '../controllers/munisipo';
|
||||||
import { SucoController } from '../controllers/suco';
|
import { SucoController } from '../controllers/suco';
|
||||||
import { ApplicationController } from '../controllers/application';
|
import { ApplicationController } from '../controllers/application';
|
||||||
|
import { NationalityController } from '../controllers/nationality';
|
||||||
|
|
||||||
export class RoutePrivate {
|
export class RoutePrivate {
|
||||||
static setup(app: express.Application) {
|
static setup(app: express.Application) {
|
||||||
@ -64,5 +65,12 @@ export class RoutePrivate {
|
|||||||
app.put('/api/application/update/:id', ApplicationController.update)
|
app.put('/api/application/update/:id', ApplicationController.update)
|
||||||
app.delete('/api/application/delete/:id/:hard', ApplicationController.delete)
|
app.delete('/api/application/delete/:id/:hard', ApplicationController.delete)
|
||||||
app.put('/api/application/restore/:id', ApplicationController.restore)
|
app.put('/api/application/restore/:id', ApplicationController.restore)
|
||||||
|
|
||||||
|
app.get('/api/nationality/list', NationalityController.list)
|
||||||
|
app.get('/api/nationality/export', NationalityController.export)
|
||||||
|
app.post('/api/nationality/create', NationalityController.create)
|
||||||
|
app.put('/api/nationality/update/:id', NationalityController.update)
|
||||||
|
app.delete('/api/nationality/delete/:id/:hard', NationalityController.delete)
|
||||||
|
app.put('/api/nationality/restore/:id', NationalityController.restore)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user