เพิ่ม link noti
This commit is contained in:
parent
0bca27a633
commit
2bfb36fd8a
2 changed files with 108 additions and 103 deletions
|
|
@ -36,6 +36,8 @@ import { ProfileSalaryHistory } from "../entities/ProfileSalaryHistory";
|
||||||
import {
|
import {
|
||||||
calculateRetireDate,
|
calculateRetireDate,
|
||||||
calculateRetireLaw,
|
calculateRetireLaw,
|
||||||
|
commandTypePath,
|
||||||
|
commandTypePathLink,
|
||||||
removeProfileInOrganize,
|
removeProfileInOrganize,
|
||||||
setLogDataDiff,
|
setLogDataDiff,
|
||||||
} from "../interfaces/utils";
|
} from "../interfaces/utils";
|
||||||
|
|
@ -556,7 +558,7 @@ export class CommandController extends Controller {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้ได้รับคำสั่ง");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผู้ได้รับคำสั่ง");
|
||||||
}
|
}
|
||||||
|
|
||||||
const path = this.commandTypePath(commandRecive.command.commandType.code);
|
const path = commandTypePath(commandRecive.command.commandType.code);
|
||||||
if (path == null) throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบประเภทคำสั่งนี้ในระบบ");
|
if (path == null) throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบประเภทคำสั่งนี้ในระบบ");
|
||||||
await new CallAPI()
|
await new CallAPI()
|
||||||
.PostData(request, path + "/delete", {
|
.PostData(request, path + "/delete", {
|
||||||
|
|
@ -863,7 +865,7 @@ export class CommandController extends Controller {
|
||||||
where: { commandId: id },
|
where: { commandId: id },
|
||||||
});
|
});
|
||||||
|
|
||||||
const path = this.commandTypePath(command.commandType.code);
|
const path = commandTypePath(command.commandType.code);
|
||||||
if (path == null) throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบประเภทคำสั่งนี้ในระบบ");
|
if (path == null) throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบประเภทคำสั่งนี้ในระบบ");
|
||||||
await new CallAPI()
|
await new CallAPI()
|
||||||
.PostData(request, path + "/delete", {
|
.PostData(request, path + "/delete", {
|
||||||
|
|
@ -1013,7 +1015,12 @@ export class CommandController extends Controller {
|
||||||
|
|
||||||
let profiles =
|
let profiles =
|
||||||
command && command.commandRecives.length > 0
|
command && command.commandRecives.length > 0
|
||||||
? command.commandRecives.filter((x) => x.profileId != null).map((x) => x.profileId)
|
? command.commandRecives
|
||||||
|
.filter((x) => x.profileId != null)
|
||||||
|
.map((x) => ({
|
||||||
|
profileId: x.profileId,
|
||||||
|
notiLink: `${process.env.API_URL}${commandTypePathLink(command.commandType.code)}/${x.refId}`,
|
||||||
|
}))
|
||||||
: [];
|
: [];
|
||||||
|
|
||||||
await new CallAPI()
|
await new CallAPI()
|
||||||
|
|
@ -1022,7 +1029,6 @@ export class CommandController extends Controller {
|
||||||
body: `${command.issue}`,
|
body: `${command.issue}`,
|
||||||
receiverUserIds: profiles,
|
receiverUserIds: profiles,
|
||||||
payload: "", //แนบไฟล์
|
payload: "", //แนบไฟล์
|
||||||
notiLink: "", //แนบไฟล์
|
|
||||||
isSendMail: true,
|
isSendMail: true,
|
||||||
isSendInbox: true,
|
isSendInbox: true,
|
||||||
isSendNotification: true,
|
isSendNotification: true,
|
||||||
|
|
@ -1044,7 +1050,7 @@ export class CommandController extends Controller {
|
||||||
command.lastUpdatedAt = new Date();
|
command.lastUpdatedAt = new Date();
|
||||||
await this.commandRepository.save(command);
|
await this.commandRepository.save(command);
|
||||||
} else {
|
} else {
|
||||||
const path = this.commandTypePath(command.commandType.code);
|
const path = commandTypePath(command.commandType.code);
|
||||||
if (path == null) throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบประเภทคำสั่งนี้ในระบบ");
|
if (path == null) throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบประเภทคำสั่งนี้ในระบบ");
|
||||||
const msg = {
|
const msg = {
|
||||||
data: {
|
data: {
|
||||||
|
|
@ -1101,7 +1107,7 @@ export class CommandController extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
command.forEach(async (x) => {
|
command.forEach(async (x) => {
|
||||||
const path = this.commandTypePath(x.commandType.code);
|
const path = commandTypePath(x.commandType.code);
|
||||||
if (path == null) throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบประเภทคำสั่งนี้ในระบบ");
|
if (path == null) throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบประเภทคำสั่งนี้ในระบบ");
|
||||||
const msg = {
|
const msg = {
|
||||||
data: {
|
data: {
|
||||||
|
|
@ -1213,7 +1219,7 @@ export class CommandController extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
let _command: any = [];
|
let _command: any = [];
|
||||||
const path = this.commandTypePath(command.commandType.code);
|
const path = commandTypePath(command.commandType.code);
|
||||||
if (path == null) throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบประเภทคำสั่งนี้ในระบบ");
|
if (path == null) throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบประเภทคำสั่งนี้ในระบบ");
|
||||||
await new CallAPI()
|
await new CallAPI()
|
||||||
.PostData(request, path + "/attachment", {
|
.PostData(request, path + "/attachment", {
|
||||||
|
|
@ -1366,7 +1372,7 @@ export class CommandController extends Controller {
|
||||||
await this.commandRepository.save(command);
|
await this.commandRepository.save(command);
|
||||||
}
|
}
|
||||||
|
|
||||||
const path = this.commandTypePath(commandCode);
|
const path = commandTypePath(commandCode);
|
||||||
if (path == null) throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบประเภทคำสั่งนี้ในระบบ");
|
if (path == null) throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบประเภทคำสั่งนี้ในระบบ");
|
||||||
await new CallAPI()
|
await new CallAPI()
|
||||||
.PostData(request, path, {
|
.PostData(request, path, {
|
||||||
|
|
@ -2845,93 +2851,4 @@ export class CommandController extends Controller {
|
||||||
await this.posMasterRepository.save(data);
|
await this.posMasterRepository.save(data);
|
||||||
return new HttpSuccess();
|
return new HttpSuccess();
|
||||||
}
|
}
|
||||||
|
|
||||||
commandTypePath(commandCode: string) {
|
|
||||||
switch (commandCode) {
|
|
||||||
case "C-PM-01":
|
|
||||||
return "/placement/recruit/report"; //
|
|
||||||
case "C-PM-02":
|
|
||||||
return "/placement/candidate/report"; //
|
|
||||||
case "C-PM-03":
|
|
||||||
return "/placement/appoint/report";
|
|
||||||
case "C-PM-04":
|
|
||||||
return "/placement/move/report";
|
|
||||||
case "C-PM-05":
|
|
||||||
return "/placement/appointment/appoint/report";
|
|
||||||
case "C-PM-06":
|
|
||||||
return "/placement/slip/report";
|
|
||||||
case "C-PM-07":
|
|
||||||
return "/placement/appointment/move/report";
|
|
||||||
case "C-PM-08":
|
|
||||||
return "/retirement/other/appoint/report";
|
|
||||||
case "C-PM-09":
|
|
||||||
return "/retirement/other/out/report";
|
|
||||||
case "C-PM-10":
|
|
||||||
return "/probation/report/command10/officer/report";
|
|
||||||
case "C-PM-11":
|
|
||||||
return "/probation/report/command11/officer/report";
|
|
||||||
case "C-PM-12":
|
|
||||||
return "/probation/report/command12/officer/report";
|
|
||||||
case "C-PM-13":
|
|
||||||
return "/placement/transfer/command/report";
|
|
||||||
case "C-PM-14":
|
|
||||||
return "/placement/receive/command/report";
|
|
||||||
case "C-PM-15":
|
|
||||||
return "/placement/officer/command/report";
|
|
||||||
case "C-PM-16":
|
|
||||||
return "/placement/repatriation/command/report";
|
|
||||||
case "C-PM-17":
|
|
||||||
return "/retirement/resign/command/report";
|
|
||||||
case "C-PM-18":
|
|
||||||
return "/retirement/out/command/report";
|
|
||||||
case "C-PM-19":
|
|
||||||
return "/discipline/result/command19/report";
|
|
||||||
case "C-PM-20":
|
|
||||||
return "/discipline/result/command20/report";
|
|
||||||
case "C-PM-21":
|
|
||||||
return "/org/command/command21/employee/report";
|
|
||||||
case "C-PM-22":
|
|
||||||
return "/placement/appointment/employee-appoint/report";
|
|
||||||
case "C-PM-23":
|
|
||||||
return "/retirement/resign/employee/report";
|
|
||||||
case "C-PM-24":
|
|
||||||
return "/placement/appointment/employee-move/report";
|
|
||||||
case "C-PM-25":
|
|
||||||
return "/discipline/result/command25/report";
|
|
||||||
case "C-PM-26":
|
|
||||||
return "/discipline/result/command26/report";
|
|
||||||
case "C-PM-27":
|
|
||||||
return "/discipline/result/command27/report";
|
|
||||||
case "C-PM-28":
|
|
||||||
return "/discipline/result/command28/report";
|
|
||||||
case "C-PM-29":
|
|
||||||
return "/discipline/result/command29/report";
|
|
||||||
case "C-PM-30":
|
|
||||||
return "/discipline/result/command30/report";
|
|
||||||
case "C-PM-31":
|
|
||||||
return "/discipline/result/command31/report";
|
|
||||||
case "C-PM-32":
|
|
||||||
return "/discipline/result/command32/report";
|
|
||||||
case "C-PM-33":
|
|
||||||
return "/salary/report/command/officer/report";
|
|
||||||
case "C-PM-34":
|
|
||||||
return "/salary/report/command/officer/report";
|
|
||||||
case "C-PM-35":
|
|
||||||
return "/salary/report/command/officer/report";
|
|
||||||
case "C-PM-36":
|
|
||||||
return "/salary/report/command/employee/report";
|
|
||||||
case "C-PM-37":
|
|
||||||
return "/salary/report/command/employee/report";
|
|
||||||
case "C-PM-38":
|
|
||||||
return "/org/command/command38/officer/report";
|
|
||||||
case "C-PM-39":
|
|
||||||
return "/placement/appointment/slip/report";
|
|
||||||
case "C-PM-40":
|
|
||||||
return "/org/command/command40/officer/report";
|
|
||||||
case "C-PM-41":
|
|
||||||
return "/retirement/resign/leave-cancel/report";
|
|
||||||
default:
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -213,9 +213,9 @@ export function editLogSequence(req: RequestWithUser, index: number, data: LogSe
|
||||||
export function commandTypePath(commandCode: string): string | null {
|
export function commandTypePath(commandCode: string): string | null {
|
||||||
switch (commandCode) {
|
switch (commandCode) {
|
||||||
case "C-PM-01":
|
case "C-PM-01":
|
||||||
return "/placement/recruit/report";
|
return "/placement/recruit/report"; //
|
||||||
case "C-PM-02":
|
case "C-PM-02":
|
||||||
return "/placement/candidate/report";
|
return "/placement/candidate/report"; //
|
||||||
case "C-PM-03":
|
case "C-PM-03":
|
||||||
return "/placement/appoint/report";
|
return "/placement/appoint/report";
|
||||||
case "C-PM-04":
|
case "C-PM-04":
|
||||||
|
|
@ -223,7 +223,7 @@ export function commandTypePath(commandCode: string): string | null {
|
||||||
case "C-PM-05":
|
case "C-PM-05":
|
||||||
return "/placement/appointment/appoint/report";
|
return "/placement/appointment/appoint/report";
|
||||||
case "C-PM-06":
|
case "C-PM-06":
|
||||||
return "/placement/appointment/slip/report";
|
return "/placement/slip/report";
|
||||||
case "C-PM-07":
|
case "C-PM-07":
|
||||||
return "/placement/appointment/move/report";
|
return "/placement/appointment/move/report";
|
||||||
case "C-PM-08":
|
case "C-PM-08":
|
||||||
|
|
@ -231,7 +231,7 @@ export function commandTypePath(commandCode: string): string | null {
|
||||||
case "C-PM-09":
|
case "C-PM-09":
|
||||||
return "/retirement/other/out/report";
|
return "/retirement/other/out/report";
|
||||||
case "C-PM-10":
|
case "C-PM-10":
|
||||||
return "/xxxxxx";
|
return "/probation/report/command10/officer/report";
|
||||||
case "C-PM-11":
|
case "C-PM-11":
|
||||||
return "/probation/report/command11/officer/report";
|
return "/probation/report/command11/officer/report";
|
||||||
case "C-PM-12":
|
case "C-PM-12":
|
||||||
|
|
@ -239,7 +239,7 @@ export function commandTypePath(commandCode: string): string | null {
|
||||||
case "C-PM-13":
|
case "C-PM-13":
|
||||||
return "/placement/transfer/command/report";
|
return "/placement/transfer/command/report";
|
||||||
case "C-PM-14":
|
case "C-PM-14":
|
||||||
return "/placement/Receive/command/report";
|
return "/placement/receive/command/report";
|
||||||
case "C-PM-15":
|
case "C-PM-15":
|
||||||
return "/placement/officer/command/report";
|
return "/placement/officer/command/report";
|
||||||
case "C-PM-16":
|
case "C-PM-16":
|
||||||
|
|
@ -289,7 +289,7 @@ export function commandTypePath(commandCode: string): string | null {
|
||||||
case "C-PM-38":
|
case "C-PM-38":
|
||||||
return "/org/command/command38/officer/report";
|
return "/org/command/command38/officer/report";
|
||||||
case "C-PM-39":
|
case "C-PM-39":
|
||||||
return "/placement/slip/report";
|
return "/placement/appointment/slip/report";
|
||||||
case "C-PM-40":
|
case "C-PM-40":
|
||||||
return "/org/command/command40/officer/report";
|
return "/org/command/command40/officer/report";
|
||||||
case "C-PM-41":
|
case "C-PM-41":
|
||||||
|
|
@ -299,3 +299,91 @@ export function commandTypePath(commandCode: string): string | null {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function commandTypePathLink(commandCode: string): string | null {
|
||||||
|
switch (commandCode) {
|
||||||
|
case "C-PM-01":
|
||||||
|
return "/placement/personal-detail";
|
||||||
|
case "C-PM-02":
|
||||||
|
return "/placement/personal-detail";
|
||||||
|
case "C-PM-03":
|
||||||
|
return "/placement/personal-detail";
|
||||||
|
case "C-PM-04":
|
||||||
|
return "/placement/personal-detail";
|
||||||
|
case "C-PM-05":
|
||||||
|
return "/xxxxxx";
|
||||||
|
case "C-PM-06":
|
||||||
|
return "/placement/personal-detail";
|
||||||
|
case "C-PM-07":
|
||||||
|
return "/xxxxxx";
|
||||||
|
case "C-PM-08":
|
||||||
|
return "/xxxxxx";
|
||||||
|
case "C-PM-09":
|
||||||
|
return "/xxxxxx";
|
||||||
|
case "C-PM-10":
|
||||||
|
return "/xxxxxx";
|
||||||
|
case "C-PM-11":
|
||||||
|
return "/xxxxxx";
|
||||||
|
case "C-PM-12":
|
||||||
|
return "/xxxxxx";
|
||||||
|
case "C-PM-13":
|
||||||
|
return "/placement/transfer";
|
||||||
|
case "C-PM-14":
|
||||||
|
return "/xxxxxx";
|
||||||
|
case "C-PM-15":
|
||||||
|
return "/xxxxxx";
|
||||||
|
case "C-PM-16":
|
||||||
|
return "/xxxxxx";
|
||||||
|
case "C-PM-17":
|
||||||
|
return "/xxxxxx";
|
||||||
|
case "C-PM-18":
|
||||||
|
return "/xxxxxx";
|
||||||
|
case "C-PM-19":
|
||||||
|
return "/xxxxxx";
|
||||||
|
case "C-PM-20":
|
||||||
|
return "/xxxxxx";
|
||||||
|
case "C-PM-21":
|
||||||
|
return "/xxxxxx";
|
||||||
|
case "C-PM-22":
|
||||||
|
return "/xxxxxx";
|
||||||
|
case "C-PM-23":
|
||||||
|
return "/xxxxxx";
|
||||||
|
case "C-PM-24":
|
||||||
|
return "/xxxxxx";
|
||||||
|
case "C-PM-25":
|
||||||
|
return "/xxxxxx";
|
||||||
|
case "C-PM-26":
|
||||||
|
return "/xxxxxx";
|
||||||
|
case "C-PM-27":
|
||||||
|
return "/xxxxxx";
|
||||||
|
case "C-PM-28":
|
||||||
|
return "/xxxxxx";
|
||||||
|
case "C-PM-29":
|
||||||
|
return "/xxxxxx";
|
||||||
|
case "C-PM-30":
|
||||||
|
return "/xxxxxx";
|
||||||
|
case "C-PM-31":
|
||||||
|
return "/xxxxxx";
|
||||||
|
case "C-PM-32":
|
||||||
|
return "/xxxxxx";
|
||||||
|
case "C-PM-33":
|
||||||
|
return "/xxxxxx";
|
||||||
|
case "C-PM-34":
|
||||||
|
return "/xxxxxx";
|
||||||
|
case "C-PM-35":
|
||||||
|
return "/xxxxxx";
|
||||||
|
case "C-PM-36":
|
||||||
|
return "/xxxxxx";
|
||||||
|
case "C-PM-37":
|
||||||
|
return "/xxxxxx";
|
||||||
|
case "C-PM-38":
|
||||||
|
return "/xxxxxx";
|
||||||
|
case "C-PM-39":
|
||||||
|
return "/xxxxxx";
|
||||||
|
case "C-PM-40":
|
||||||
|
return "/xxxxxx";
|
||||||
|
case "C-PM-41":
|
||||||
|
return "/xxxxxx";
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue