fix ปลดตำแหน่ง/ลบkeycloak คำสั่ง 12, 13, 17, 18, 19, 20, 23,
This commit is contained in:
parent
038eb37842
commit
eecc6f22c9
3 changed files with 73 additions and 3 deletions
|
|
@ -6,6 +6,7 @@ import { EmployeePosMaster } from "../entities/EmployeePosMaster";
|
|||
import { EmployeePosition } from "../entities/EmployeePosition";
|
||||
import { In } from "typeorm";
|
||||
import { RequestWithUser } from "../middlewares/user";
|
||||
import { Command } from "../entities/Command";
|
||||
export function calculateAge(start: Date, end = new Date()) {
|
||||
if (start.getTime() > end.getTime()) return null;
|
||||
|
||||
|
|
@ -173,6 +174,21 @@ export async function removeProfileInOrganize(profileId: string, type: string) {
|
|||
.execute();
|
||||
}
|
||||
}
|
||||
|
||||
export async function checkCommandType(commandId: string) {
|
||||
const commandRepository = AppDataSource.getRepository(Command);
|
||||
const _type = await commandRepository.findOne({
|
||||
where: {
|
||||
id: commandId
|
||||
},
|
||||
relations: ["commandType"],
|
||||
});
|
||||
if (!["C-PM-12", "C-PM-13", "C-PM-17", "C-PM-18", "C-PM-23", "C-PM-19", "C-PM-20"].includes(String(_type?.commandType.code))) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//logs
|
||||
export type DataDiff = {
|
||||
before: any;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue