test เผยแพร่
This commit is contained in:
parent
3a6d359a06
commit
5c5fc08269
4 changed files with 22 additions and 22 deletions
|
|
@ -66,7 +66,8 @@ async function main() {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Cron job for updating org revision - every day at 01:00:00
|
// 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 03 11 * * *";
|
||||||
cron.schedule(cronTime, async () => {
|
cron.schedule(cronTime, async () => {
|
||||||
try {
|
try {
|
||||||
const orgController = new OrganizationController();
|
const orgController = new OrganizationController();
|
||||||
|
|
|
||||||
|
|
@ -65,8 +65,7 @@ export class PermissionProfileController extends Controller {
|
||||||
|
|
||||||
if (!request.user.role.includes("SUPER_ADMIN")) {
|
if (!request.user.role.includes("SUPER_ADMIN")) {
|
||||||
rootId =
|
rootId =
|
||||||
orgRevisionActive?.posMasters?.filter((x) => x.next_holderId == profile.id)[0]
|
orgRevisionActive?.posMasters?.filter((x) => x.current_holderId == profile.id)[0]
|
||||||
// orgRevisionActive?.posMasters?.filter((x) => x.current_holderId == profile.id)[0]
|
|
||||||
?.orgRootId || null;
|
?.orgRootId || null;
|
||||||
if (!rootId) return new HttpSuccess([]);
|
if (!rootId) return new HttpSuccess([]);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -477,10 +477,10 @@ export async function BatchSavePosMasterHistoryOfficer(
|
||||||
const profileChanged = existing && existing.profileId !== op.profileId;
|
const profileChanged = existing && existing.profileId !== op.profileId;
|
||||||
const positionChanged =
|
const positionChanged =
|
||||||
existing &&
|
existing &&
|
||||||
existing.position !== op.pm?.position &&
|
(existing.position !== op.pm?.position ||
|
||||||
existing.posType !== op.pm?.posType &&
|
existing.posType !== op.pm?.posType ||
|
||||||
existing.posLevel !== op.pm?.posLevel &&
|
existing.posLevel !== op.pm?.posLevel ||
|
||||||
existing.posExecutive !== op.pm?.posExecutive;
|
existing.posExecutive !== op.pm?.posExecutive);
|
||||||
|
|
||||||
// ถ้าไม่มี record เดิม หรือ profile เปลี่ยน หรือ position เปลี่ยน ให้สร้าง record ใหม่
|
// ถ้าไม่มี record เดิม หรือ profile เปลี่ยน หรือ position เปลี่ยน ให้สร้าง record ใหม่
|
||||||
if (shouldInsert || profileChanged || positionChanged) {
|
if (shouldInsert || profileChanged || positionChanged) {
|
||||||
|
|
|
||||||
|
|
@ -1732,23 +1732,23 @@ async function clearMenuAndRoleCache(): Promise<void> {
|
||||||
console.log(`[AMQ] Cleared ${roleKeys.length} role cache keys`);
|
console.log(`[AMQ] Cleared ${roleKeys.length} role cache keys`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// const posMasterKeys = await keysAsync("posMaster_*");
|
const posMasterKeys = await keysAsync("posMaster_*");
|
||||||
// if (posMasterKeys.length > 0) {
|
if (posMasterKeys.length > 0) {
|
||||||
// await delAsync(...posMasterKeys);
|
await delAsync(...posMasterKeys);
|
||||||
// console.log(`[AMQ] Cleared ${posMasterKeys.length} posMaster cache keys`);
|
console.log(`[AMQ] Cleared ${posMasterKeys.length} posMaster cache keys`);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// const userKeys = await keysAsync("user_*");
|
const userKeys = await keysAsync("user_*");
|
||||||
// if (userKeys.length > 0) {
|
if (userKeys.length > 0) {
|
||||||
// await delAsync(...userKeys);
|
await delAsync(...userKeys);
|
||||||
// console.log(`[AMQ] Cleared ${userKeys.length} user cache keys`);
|
console.log(`[AMQ] Cleared ${userKeys.length} user cache keys`);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// const orgKeys = await keysAsync("org_*");
|
const orgKeys = await keysAsync("org_*");
|
||||||
// if (orgKeys.length > 0) {
|
if (orgKeys.length > 0) {
|
||||||
// await delAsync(...orgKeys);
|
await delAsync(...orgKeys);
|
||||||
// console.log(`[AMQ] Cleared ${orgKeys.length} org cache keys`);
|
console.log(`[AMQ] Cleared ${orgKeys.length} org cache keys`);
|
||||||
// }
|
}
|
||||||
} finally {
|
} finally {
|
||||||
redisClient.quit();
|
redisClient.quit();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue