add response websocket
This commit is contained in:
parent
0ba4b28331
commit
8c0c5f8040
1 changed files with 22 additions and 4 deletions
|
|
@ -394,7 +394,18 @@ async function handler_org(msg: amqp.ConsumeMessage): Promise<boolean> {
|
|||
const child2Repository = AppDataSource.getRepository(OrgChild2);
|
||||
const child3Repository = AppDataSource.getRepository(OrgChild3);
|
||||
const child4Repository = AppDataSource.getRepository(OrgChild4);
|
||||
|
||||
const { data, token, user } = JSON.parse(msg.content.toString());
|
||||
const { id, status, lastUpdateUserId, lastUpdateFullName, lastUpdatedAt } = data;
|
||||
if (user) {
|
||||
sendWebSocket(
|
||||
"send-publish-org",
|
||||
{
|
||||
success: true,
|
||||
message: `ระบบกำลังทำการแพร่โครงสร้างหน่วยงาน`,
|
||||
},
|
||||
{ userId: user?.sub },
|
||||
).catch(console.error);
|
||||
}
|
||||
const orgRevisionPublish = await repoOrgRevision
|
||||
.createQueryBuilder("orgRevision")
|
||||
.where("orgRevision.orgRevisionIsDraft = false")
|
||||
|
|
@ -418,8 +429,6 @@ async function handler_org(msg: amqp.ConsumeMessage): Promise<boolean> {
|
|||
orgRevisionDraft.orgRevisionIsDraft = false;
|
||||
await repoOrgRevision.save(orgRevisionDraft);
|
||||
}
|
||||
const { data, token, user } = JSON.parse(msg.content.toString());
|
||||
const { id, status, lastUpdateUserId, lastUpdateFullName, lastUpdatedAt } = data;
|
||||
try {
|
||||
const posMaster = await repoPosmaster.find({
|
||||
where: { orgRevisionId: id },
|
||||
|
|
@ -1443,7 +1452,16 @@ async function handler_org_draft(msg: amqp.ConsumeMessage): Promise<boolean> {
|
|||
const child2Repository = AppDataSource.getRepository(OrgChild2);
|
||||
const child3Repository = AppDataSource.getRepository(OrgChild3);
|
||||
const child4Repository = AppDataSource.getRepository(OrgChild4);
|
||||
|
||||
if (user) {
|
||||
sendWebSocket(
|
||||
"send-publish-org",
|
||||
{
|
||||
success: true,
|
||||
message: `ระบบกำลังทำการสร้างโครงสร้างหน่วยงาน`,
|
||||
},
|
||||
{ userId: user?.sub },
|
||||
).catch(console.error);
|
||||
}
|
||||
try {
|
||||
//cone tree
|
||||
if (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue