เพิ่ม noti
This commit is contained in:
parent
0269036af7
commit
3871ec5f9f
3 changed files with 40 additions and 5 deletions
|
|
@ -895,6 +895,24 @@ export class CommandController extends Controller {
|
||||||
command.isSign = true;
|
command.isSign = true;
|
||||||
if (command.commandExcecuteDate == null)
|
if (command.commandExcecuteDate == null)
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบวันที่คำสั่งมีผล");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบวันที่คำสั่งมีผล");
|
||||||
|
|
||||||
|
let profiles = command.commandRecives
|
||||||
|
.filter((x) => x.profileId != null)
|
||||||
|
.map(async (x) => x.profileId);
|
||||||
|
|
||||||
|
await new CallAPI()
|
||||||
|
.PostData(request, "/placement/noti/profiles", {
|
||||||
|
subject: `${command.issue}`,
|
||||||
|
body: `${command.issue}`,
|
||||||
|
receiverUserId: profiles,
|
||||||
|
payload: "",//แนบไฟล์
|
||||||
|
isSendMail: true,
|
||||||
|
isSendInbox: true,
|
||||||
|
receiveDate: command.commandExcecuteDate,
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error("Error calling API:", error);
|
||||||
|
});
|
||||||
if (
|
if (
|
||||||
new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate()) <
|
new Date(new Date().getFullYear(), new Date().getMonth(), new Date().getDate()) <
|
||||||
new Date(
|
new Date(
|
||||||
|
|
@ -1049,6 +1067,7 @@ export class CommandController extends Controller {
|
||||||
commandExcecuteDate?: Date | null;
|
commandExcecuteDate?: Date | null;
|
||||||
persons: {
|
persons: {
|
||||||
refId: string;
|
refId: string;
|
||||||
|
profileId?: string|null;
|
||||||
citizenId: string;
|
citizenId: string;
|
||||||
prefix: string;
|
prefix: string;
|
||||||
firstName: string;
|
firstName: string;
|
||||||
|
|
|
||||||
|
|
@ -101,11 +101,13 @@ export class CommandRecive extends EntityBase {
|
||||||
@JoinColumn({ name: "commandId" })
|
@JoinColumn({ name: "commandId" })
|
||||||
command: Command;
|
command: Command;
|
||||||
|
|
||||||
// @Column({
|
@Column({
|
||||||
// length: 40,
|
nullable: true,
|
||||||
// comment: "คีย์นอก(FK)ของตาราง profile",
|
length: 40,
|
||||||
// })
|
comment: "คีย์นอก(FK)ของตาราง profile",
|
||||||
// profileId: string;
|
default: null,
|
||||||
|
})
|
||||||
|
profileId: string;
|
||||||
|
|
||||||
// @ManyToOne(() => Profile, (profile) => profile.commandRecives)
|
// @ManyToOne(() => Profile, (profile) => profile.commandRecives)
|
||||||
// @JoinColumn({ name: "profileId" })
|
// @JoinColumn({ name: "profileId" })
|
||||||
|
|
|
||||||
14
src/migration/1728318691161-add_table_assign1.ts
Normal file
14
src/migration/1728318691161-add_table_assign1.ts
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
import { MigrationInterface, QueryRunner } from "typeorm";
|
||||||
|
|
||||||
|
export class AddTableAssign11728318691161 implements MigrationInterface {
|
||||||
|
name = 'AddTableAssign11728318691161'
|
||||||
|
|
||||||
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE \`commandRecive\` ADD \`profileId\` varchar(40) NULL COMMENT 'คีย์นอก(FK)ของตาราง profile'`);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE \`commandRecive\` DROP COLUMN \`profileId\``);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue