test เผยแพร่

This commit is contained in:
Adisak 2026-06-15 10:58:56 +07:00
parent 3a6d359a06
commit 5c5fc08269
4 changed files with 22 additions and 22 deletions

View file

@ -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 03 11 * * *";
cron.schedule(cronTime, async () => {
try {
const orgController = new OrganizationController();

View file

@ -65,8 +65,7 @@ export class PermissionProfileController extends Controller {
if (!request.user.role.includes("SUPER_ADMIN")) {
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;
if (!rootId) return new HttpSuccess([]);
}

View file

@ -477,10 +477,10 @@ export async function BatchSavePosMasterHistoryOfficer(
const profileChanged = existing && existing.profileId !== op.profileId;
const positionChanged =
existing &&
existing.position !== op.pm?.position &&
existing.posType !== op.pm?.posType &&
existing.posLevel !== op.pm?.posLevel &&
existing.posExecutive !== op.pm?.posExecutive;
(existing.position !== op.pm?.position ||
existing.posType !== op.pm?.posType ||
existing.posLevel !== op.pm?.posLevel ||
existing.posExecutive !== op.pm?.posExecutive);
// ถ้าไม่มี record เดิม หรือ profile เปลี่ยน หรือ position เปลี่ยน ให้สร้าง record ใหม่
if (shouldInsert || profileChanged || positionChanged) {

View file

@ -1732,23 +1732,23 @@ async function clearMenuAndRoleCache(): Promise<void> {
console.log(`[AMQ] Cleared ${roleKeys.length} role cache keys`);
}
// const posMasterKeys = await keysAsync("posMaster_*");
// if (posMasterKeys.length > 0) {
// await delAsync(...posMasterKeys);
// console.log(`[AMQ] Cleared ${posMasterKeys.length} posMaster cache keys`);
// }
const posMasterKeys = await keysAsync("posMaster_*");
if (posMasterKeys.length > 0) {
await delAsync(...posMasterKeys);
console.log(`[AMQ] Cleared ${posMasterKeys.length} posMaster cache keys`);
}
// const userKeys = await keysAsync("user_*");
// if (userKeys.length > 0) {
// await delAsync(...userKeys);
// console.log(`[AMQ] Cleared ${userKeys.length} user cache keys`);
// }
const userKeys = await keysAsync("user_*");
if (userKeys.length > 0) {
await delAsync(...userKeys);
console.log(`[AMQ] Cleared ${userKeys.length} user cache keys`);
}
// const orgKeys = await keysAsync("org_*");
// if (orgKeys.length > 0) {
// await delAsync(...orgKeys);
// console.log(`[AMQ] Cleared ${orgKeys.length} org cache keys`);
// }
const orgKeys = await keysAsync("org_*");
if (orgKeys.length > 0) {
await delAsync(...orgKeys);
console.log(`[AMQ] Cleared ${orgKeys.length} org cache keys`);
}
} finally {
redisClient.quit();
}