update
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@ -8,3 +8,4 @@ temp/
|
|||||||
package-lock.json
|
package-lock.json
|
||||||
src/swagger/swagger.json
|
src/swagger/swagger.json
|
||||||
swagger.json
|
swagger.json
|
||||||
|
config/ferro.json
|
||||||
@ -48,7 +48,7 @@ export class AuthController {
|
|||||||
|
|
||||||
const user = await userRepository.findOne({
|
const user = await userRepository.findOne({
|
||||||
relations: ["roles", "roles.application"],
|
relations: ["roles", "roles.application"],
|
||||||
select: ["id", "email", "name", "employee_id", "password", "username", "roles"],
|
select: ["id", "email", "name", "password", "username", "roles"],
|
||||||
where: { username: param.username },
|
where: { username: param.username },
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -109,7 +109,6 @@ export class AuthController {
|
|||||||
name: user.name,
|
name: user.name,
|
||||||
id_role: role_id,
|
id_role: role_id,
|
||||||
roles: roles.roles,
|
roles: roles.roles,
|
||||||
employee_id: user.employee_id,
|
|
||||||
hrms: hrms,
|
hrms: hrms,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import axios from "axios"
|
import axios from "axios"
|
||||||
import config from "config"
|
import config from "config"
|
||||||
import { Paging, User, UserRefreshToken, UserRole } from "entity"
|
import { HrmsEmployee, Paging, User, UserRefreshToken, UserRole } from "entity"
|
||||||
import exceljs from "exceljs"
|
import exceljs from "exceljs"
|
||||||
import { NextFunction, Response } from "express"
|
import { NextFunction, Response } from "express"
|
||||||
import { Request } from "express-jwt"
|
import { Request } from "express-jwt"
|
||||||
@ -247,7 +247,7 @@ export class UserController {
|
|||||||
password: Joi.string().pattern(new RegExp("^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$%^&*-]).{8,}$")).min(8).required().label("Password"),
|
password: Joi.string().pattern(new RegExp("^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$%^&*-]).{8,}$")).min(8).required().label("Password"),
|
||||||
retype_password: Joi.ref("password"),
|
retype_password: Joi.ref("password"),
|
||||||
name: Joi.string().max(64).required().label("Name"),
|
name: Joi.string().max(64).required().label("Name"),
|
||||||
employee_id: Joi.string().max(64).optional().allow("").label("Employee ID"),
|
employee_id: Joi.string().uuid().optional().allow("").label("Employee ID"),
|
||||||
status: Joi.string().required().label("Status"),
|
status: Joi.string().required().label("Status"),
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -260,8 +260,8 @@ export class UserController {
|
|||||||
data.email = param.email
|
data.email = param.email
|
||||||
data.status = param.status
|
data.status = param.status
|
||||||
|
|
||||||
if (param.employee_id && param.employee_id! + "") {
|
if (param.employee && param.employee.id! + "") {
|
||||||
data.employee_id = param.employee_id
|
data.employee = param.employee
|
||||||
}
|
}
|
||||||
|
|
||||||
data.hashPassword()
|
data.hashPassword()
|
||||||
@ -571,7 +571,7 @@ export class UserController {
|
|||||||
password: Joi.string().allow("").optional().label("Password"),
|
password: Joi.string().allow("").optional().label("Password"),
|
||||||
retype_password: Joi.ref("password"),
|
retype_password: Joi.ref("password"),
|
||||||
name: Joi.string().max(64).required().label("Name"),
|
name: Joi.string().max(64).required().label("Name"),
|
||||||
employee_id: Joi.string().max(64).optional().allow("").label("Employee ID"),
|
employee_id: Joi.string().uuid().optional().allow("").label("Employee ID"),
|
||||||
status: Joi.string().required().label("Status"),
|
status: Joi.string().required().label("Status"),
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -585,13 +585,13 @@ export class UserController {
|
|||||||
|
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
data.name = param.name
|
data.name = param.name
|
||||||
data.employee_id = param.employee_id
|
data.employee = param.employee
|
||||||
data.username = param.username
|
data.username = param.username
|
||||||
data.email = param.email
|
data.email = param.email
|
||||||
data.status = param.status
|
data.status = param.status
|
||||||
|
|
||||||
if (param.employee_id && param.employee_id != "") {
|
if (param.employee && param.employee.id != "") {
|
||||||
data.employee_id = param.employee_id
|
data.employee = param.employee
|
||||||
}
|
}
|
||||||
|
|
||||||
if (param.password) {
|
if (param.password) {
|
||||||
|
|||||||
@ -1,15 +1,32 @@
|
|||||||
import config from 'config';
|
import config from "config"
|
||||||
import { DataSource } from "typeorm";
|
import { DataSource } from "typeorm"
|
||||||
import { Application, Menu, User, UserActivity, UserRefreshToken, UserRole } from "entity";
|
import {
|
||||||
import { ILogObj, Logger } from 'tslog';
|
Aldeia,
|
||||||
|
Suco,
|
||||||
|
Munisipo,
|
||||||
|
Administrativu,
|
||||||
|
Nationality,
|
||||||
|
Application, //
|
||||||
|
Menu,
|
||||||
|
User,
|
||||||
|
UserActivity,
|
||||||
|
UserRefreshToken,
|
||||||
|
UserRole,
|
||||||
|
HrmsAirport,
|
||||||
|
HrmsPosition,
|
||||||
|
HrmsEmployee,
|
||||||
|
HrmsDepartment,
|
||||||
|
HrmsShift,
|
||||||
|
} from "entity"
|
||||||
|
import { ILogObj, Logger } from "tslog"
|
||||||
|
|
||||||
export class OrmHelper {
|
export class OrmHelper {
|
||||||
static DB: DataSource = null
|
static DB: DataSource = null
|
||||||
|
|
||||||
static setup() {
|
static setup() {
|
||||||
const log: Logger<ILogObj> = new Logger({ name: '[OrmHelper]', type: 'pretty' });
|
const log: Logger<ILogObj> = new Logger({ name: "[OrmHelper]", type: "pretty" })
|
||||||
|
|
||||||
const engine: 'mysql' | 'postgres' = config.get("database.engine")
|
const engine: "mysql" | "postgres" = config.get("database.engine")
|
||||||
|
|
||||||
OrmHelper.DB = new DataSource({
|
OrmHelper.DB = new DataSource({
|
||||||
type: engine,
|
type: engine,
|
||||||
@ -19,8 +36,26 @@ export class OrmHelper {
|
|||||||
password: String(config.get("database.password")),
|
password: String(config.get("database.password")),
|
||||||
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: [User, UserRole, UserActivity, UserRefreshToken, Menu, Application],
|
entities: [
|
||||||
|
Aldeia,
|
||||||
|
Suco,
|
||||||
|
Munisipo,
|
||||||
|
Administrativu,
|
||||||
|
Nationality,
|
||||||
|
User, //
|
||||||
|
UserRole,
|
||||||
|
UserActivity,
|
||||||
|
UserRefreshToken,
|
||||||
|
Menu,
|
||||||
|
Application,
|
||||||
|
Nationality,
|
||||||
|
HrmsDepartment, //
|
||||||
|
HrmsAirport,
|
||||||
|
HrmsPosition,
|
||||||
|
HrmsShift,
|
||||||
|
HrmsEmployee,
|
||||||
|
],
|
||||||
subscribers: [],
|
subscribers: [],
|
||||||
migrations: [],
|
migrations: [],
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user