From 03c57ddcceeec9a7f97fc3849d47d89509265a9e Mon Sep 17 00:00:00 2001 From: harid Date: Fri, 12 Jun 2026 15:01:14 +0700 Subject: [PATCH 1/7] fix #251 --- src/app.ts | 3 ++- src/services/rabbitmq.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/app.ts b/src/app.ts index c2cbe5f7..8a01ec6e 100644 --- a/src/app.ts +++ b/src/app.ts @@ -66,7 +66,8 @@ async function main() { }); // Cron job for updating org revision - every day at 01:00:00 - const cronTime = "0 0 1 * * *"; + // const cronTime = "0 0 1 * * *"; + const cronTime = "0 20 15 * * *"; // test by dev cron.schedule(cronTime, async () => { try { const orgController = new OrganizationController(); diff --git a/src/services/rabbitmq.ts b/src/services/rabbitmq.ts index e06474b9..93c7ef7e 100644 --- a/src/services/rabbitmq.ts +++ b/src/services/rabbitmq.ts @@ -904,7 +904,7 @@ async function handler_org(msg: amqp.ConsumeMessage): Promise { posType: posTypeName, posLevel: posLevelName, posExecutive: posExecutiveName, - profileId: _null, + profileId: nextHolderProfile?.id || _null, rootDnaId: item.orgRoot?.ancestorDNA || _null, child1DnaId: item.orgChild1?.ancestorDNA || _null, child2DnaId: item.orgChild2?.ancestorDNA || _null, From 94fe50eba60a8105a9516349d313c4229a9dba17 Mon Sep 17 00:00:00 2001 From: harid Date: Fri, 12 Jun 2026 15:23:18 +0700 Subject: [PATCH 2/7] test --- src/app.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app.ts b/src/app.ts index 8a01ec6e..de00b19c 100644 --- a/src/app.ts +++ b/src/app.ts @@ -67,7 +67,7 @@ async function main() { // Cron job for updating org revision - every day at 01:00:00 // const cronTime = "0 0 1 * * *"; - const cronTime = "0 20 15 * * *"; // test by dev + const cronTime = "0 26 15 * * *"; // test by dev cron.schedule(cronTime, async () => { try { const orgController = new OrganizationController(); From e10b1a3109a04e4900c9b5c22ab1a3243b1c6977 Mon Sep 17 00:00:00 2001 From: harid Date: Fri, 12 Jun 2026 15:38:16 +0700 Subject: [PATCH 3/7] no message --- src/app.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app.ts b/src/app.ts index de00b19c..a09d47eb 100644 --- a/src/app.ts +++ b/src/app.ts @@ -67,7 +67,7 @@ async function main() { // Cron job for updating org revision - every day at 01:00:00 // const cronTime = "0 0 1 * * *"; - const cronTime = "0 26 15 * * *"; // test by dev + const cronTime = "0 45 15 * * *"; // test by dev cron.schedule(cronTime, async () => { try { const orgController = new OrganizationController(); From d84ec4f55d0adc20a69f6de45851ab9797535892 Mon Sep 17 00:00:00 2001 From: harid Date: Fri, 12 Jun 2026 15:58:31 +0700 Subject: [PATCH 4/7] test --- src/app.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app.ts b/src/app.ts index a09d47eb..ab3b372c 100644 --- a/src/app.ts +++ b/src/app.ts @@ -67,7 +67,7 @@ async function main() { // Cron job for updating org revision - every day at 01:00:00 // const cronTime = "0 0 1 * * *"; - const cronTime = "0 45 15 * * *"; // test by dev + const cronTime = "0 10 16 * * *"; // test by dev cron.schedule(cronTime, async () => { try { const orgController = new OrganizationController(); From aeae391034af6847b086eb316f0b9d739d84caa1 Mon Sep 17 00:00:00 2001 From: harid Date: Fri, 12 Jun 2026 17:53:23 +0700 Subject: [PATCH 5/7] no message --- src/app.ts | 3 +-- src/controllers/ProfileChangeNameController.ts | 10 ++++++++-- src/controllers/ProfileController.ts | 4 ++++ 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/app.ts b/src/app.ts index ab3b372c..c2cbe5f7 100644 --- a/src/app.ts +++ b/src/app.ts @@ -66,8 +66,7 @@ async function main() { }); // Cron job for updating org revision - every day at 01:00:00 - // const cronTime = "0 0 1 * * *"; - const cronTime = "0 10 16 * * *"; // test by dev + const cronTime = "0 0 1 * * *"; cron.schedule(cronTime, async () => { try { const orgController = new OrganizationController(); diff --git a/src/controllers/ProfileChangeNameController.ts b/src/controllers/ProfileChangeNameController.ts index 0261666f..18bd4922 100644 --- a/src/controllers/ProfileChangeNameController.ts +++ b/src/controllers/ProfileChangeNameController.ts @@ -111,9 +111,15 @@ export class ProfileChangeNameController extends Controller { setLogDataDiff(req, { before, after: history }); profile.firstName = body.firstName ?? profile.firstName; profile.lastName = body.lastName ?? profile.lastName; - profile.prefix = body.prefix ?? profile.prefix; + //old + // profile.prefix = body.prefix ?? profile.prefix; + // profile.rank = body.rank ?? profile.rank; + // profile.prefixMain = profile.rank ?? profile.prefix; + //new + profile.prefixMain = profile.prefix; + profile.prefix = profile.rank && profile.rank.length > 0 ? profile.rank : profile.prefix; profile.rank = body.rank ?? profile.rank; - profile.prefixMain = profile.rank ?? profile.prefix; + await this.profileRepository.save(profile, { data: req }); setLogDataDiff(req, { before, after: profile }); diff --git a/src/controllers/ProfileController.ts b/src/controllers/ProfileController.ts index 42b322d3..c2bb6420 100644 --- a/src/controllers/ProfileController.ts +++ b/src/controllers/ProfileController.ts @@ -5800,8 +5800,12 @@ export class ProfileController extends Controller { Object.assign(record, body); record.dateRetireLaw = calculateRetireLaw(record.birthDate); + //old record.prefixMain = record.prefix; record.prefix = record.rank && record.rank.length > 0 ? record.rank : record.prefixMain; + //new + record.prefixMain = record.prefix; + record.prefix = record.rank && record.rank.length > 0 ? record.rank : record.prefix; record.createdUserId = request.user.sub; record.createdFullName = request.user.name; record.createdAt = new Date(); From 8232c6696ec4d57e398b469060aa61ab760528cf Mon Sep 17 00:00:00 2001 From: harid Date: Fri, 12 Jun 2026 17:53:33 +0700 Subject: [PATCH 6/7] no message --- src/controllers/ProfileController.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/controllers/ProfileController.ts b/src/controllers/ProfileController.ts index c2bb6420..c2925193 100644 --- a/src/controllers/ProfileController.ts +++ b/src/controllers/ProfileController.ts @@ -5801,8 +5801,8 @@ export class ProfileController extends Controller { Object.assign(record, body); record.dateRetireLaw = calculateRetireLaw(record.birthDate); //old - record.prefixMain = record.prefix; - record.prefix = record.rank && record.rank.length > 0 ? record.rank : record.prefixMain; + // record.prefixMain = record.prefix; + // record.prefix = record.rank && record.rank.length > 0 ? record.rank : record.prefixMain; //new record.prefixMain = record.prefix; record.prefix = record.rank && record.rank.length > 0 ? record.rank : record.prefix; From 7920832c5c62a976b9766257bf47194cec5804a6 Mon Sep 17 00:00:00 2001 From: harid Date: Fri, 12 Jun 2026 18:02:54 +0700 Subject: [PATCH 7/7] revert --- src/controllers/ProfileChangeNameController.ts | 9 ++------- src/controllers/ProfileController.ts | 6 +----- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/controllers/ProfileChangeNameController.ts b/src/controllers/ProfileChangeNameController.ts index 18bd4922..3f61301f 100644 --- a/src/controllers/ProfileChangeNameController.ts +++ b/src/controllers/ProfileChangeNameController.ts @@ -111,14 +111,9 @@ export class ProfileChangeNameController extends Controller { setLogDataDiff(req, { before, after: history }); profile.firstName = body.firstName ?? profile.firstName; profile.lastName = body.lastName ?? profile.lastName; - //old - // profile.prefix = body.prefix ?? profile.prefix; - // profile.rank = body.rank ?? profile.rank; - // profile.prefixMain = profile.rank ?? profile.prefix; - //new - profile.prefixMain = profile.prefix; - profile.prefix = profile.rank && profile.rank.length > 0 ? profile.rank : profile.prefix; + profile.prefix = body.prefix ?? profile.prefix; profile.rank = body.rank ?? profile.rank; + profile.prefixMain = profile.rank ?? profile.prefix; await this.profileRepository.save(profile, { data: req }); setLogDataDiff(req, { before, after: profile }); diff --git a/src/controllers/ProfileController.ts b/src/controllers/ProfileController.ts index c2925193..42b322d3 100644 --- a/src/controllers/ProfileController.ts +++ b/src/controllers/ProfileController.ts @@ -5800,12 +5800,8 @@ export class ProfileController extends Controller { Object.assign(record, body); record.dateRetireLaw = calculateRetireLaw(record.birthDate); - //old - // record.prefixMain = record.prefix; - // record.prefix = record.rank && record.rank.length > 0 ? record.rank : record.prefixMain; - //new record.prefixMain = record.prefix; - record.prefix = record.rank && record.rank.length > 0 ? record.rank : record.prefix; + record.prefix = record.rank && record.rank.length > 0 ? record.rank : record.prefixMain; record.createdUserId = request.user.sub; record.createdFullName = request.user.name; record.createdAt = new Date();