migrate + fix issue #993
This commit is contained in:
parent
7a0ab2271d
commit
4011abe5ea
5 changed files with 142 additions and 43 deletions
|
|
@ -334,6 +334,7 @@ export async function checkReturnCommandType(commandId: string) {
|
|||
|
||||
export async function checkExceptCommandType(commandId: string) {
|
||||
const commandRepository = AppDataSource.getRepository(Command);
|
||||
const commandReciveRepository = AppDataSource.getRepository(CommandRecive)
|
||||
const _type = await commandRepository.findOne({
|
||||
where: {
|
||||
id: commandId,
|
||||
|
|
@ -341,9 +342,27 @@ export async function checkExceptCommandType(commandId: string) {
|
|||
relations: ["commandType"],
|
||||
});
|
||||
if (!["C-PM-25", "C-PM-26"].includes(String(_type?.commandType.code))) {
|
||||
return false;
|
||||
return { status: false, LeaveType: null, leaveRemark: null};
|
||||
}
|
||||
return true;
|
||||
const _commandRecive = await commandReciveRepository.findOne({
|
||||
where: { commandId: commandId }
|
||||
});
|
||||
|
||||
let _leaveType: string =""
|
||||
switch(String(_type?.commandType.code)){
|
||||
case "C-PM-25" : {
|
||||
_leaveType = "DISCIPLINE_SUSPEND"; //คำสั่งพักจากราชการ
|
||||
break;
|
||||
}
|
||||
case "C-PM-26" : {
|
||||
_leaveType = "DISCIPLINE_SUSPEND"; //คำสั่งให้ออกจากราชการไว้ก่อน
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
_leaveType = ""
|
||||
}
|
||||
}
|
||||
return { status: true, LeaveType: _leaveType, leaveRemark: _commandRecive ? _commandRecive.remarkVertical : null };
|
||||
}
|
||||
|
||||
export async function checkCommandType(commandId: string) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue