add pass redis test
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m6s

This commit is contained in:
harid 2026-06-29 16:01:16 +07:00
parent 7b37cc37db
commit 2f7ec40e78
8 changed files with 23 additions and 5 deletions

View file

@ -128,6 +128,7 @@ export class AuthRoleController extends Controller {
redisClient = await this.redis.createClient({
host: REDIS_HOST,
port: REDIS_PORT,
password: process.env.REDIS_PASSWORD,
});
redisClient.del("role_" + posMaster.current_holderId, (err: Error) => {
@ -296,6 +297,7 @@ export class AuthRoleController extends Controller {
redisClient = await this.redis.createClient({
host: REDIS_HOST,
port: REDIS_PORT,
password: process.env.REDIS_PASSWORD,
});
await redisClient.flushdb(function (err: any, succeeded: any) {

View file

@ -8830,6 +8830,7 @@ export class OrganizationController extends Controller {
const redisClient = redis.createClient({
host: process.env.REDIS_HOST || "localhost",
port: parseInt(process.env.REDIS_PORT || "6379"),
password: process.env.REDIS_PASSWORD,
});
const keysAsync = promisify(redisClient.keys).bind(redisClient);
const delAsync = promisify(redisClient.del).bind(redisClient);

View file

@ -42,6 +42,7 @@ export class PermissionController extends Controller {
redisClient = await this.redis.createClient({
host: REDIS_HOST,
port: REDIS_PORT,
password: process.env.REDIS_PASSWORD,
});
const getAsync = promisify(redisClient.get).bind(redisClient);
@ -293,6 +294,7 @@ export class PermissionController extends Controller {
redisClient = await this.redis.createClient({
host: REDIS_HOST,
port: REDIS_PORT,
password: process.env.REDIS_PASSWORD,
});
const getAsync = promisify(redisClient.get).bind(redisClient);
@ -691,6 +693,7 @@ export class PermissionController extends Controller {
redisClient = await this.redis.createClient({
host: REDIS_HOST,
port: REDIS_PORT,
password: process.env.REDIS_PASSWORD,
});
const getAsync = promisify(redisClient.get).bind(redisClient);
@ -807,6 +810,7 @@ export class PermissionController extends Controller {
redisClient = await this.redis.createClient({
host: REDIS_HOST,
port: REDIS_PORT,
password: process.env.REDIS_PASSWORD,
});
const getAsync = promisify(redisClient.get).bind(redisClient);
@ -902,6 +906,7 @@ export class PermissionController extends Controller {
redisClient = await this.redis.createClient({
host: REDIS_HOST,
port: REDIS_PORT,
password: process.env.REDIS_PASSWORD,
});
const getAsync = promisify(redisClient.get).bind(redisClient);
@ -1155,6 +1160,7 @@ export class PermissionController extends Controller {
redisClient = await this.redis.createClient({
host: REDIS_HOST,
port: REDIS_PORT,
password: process.env.REDIS_PASSWORD,
});
const getAsync = promisify(redisClient.get).bind(redisClient);
@ -1413,6 +1419,7 @@ export class PermissionController extends Controller {
redisClient = await this.redis.createClient({
host: REDIS_HOST,
port: REDIS_PORT,
password: process.env.REDIS_PASSWORD,
});
// const getAsync = promisify(redisClient.get).bind(redisClient);

View file

@ -328,6 +328,7 @@ export class PosMasterActController extends Controller {
const redisClient = await this.redis.createClient({
host: REDIS_HOST,
port: REDIS_PORT,
password: process.env.REDIS_PASSWORD,
});
const delAsync = promisify(redisClient.del).bind(redisClient);
@ -865,6 +866,7 @@ export class PosMasterActController extends Controller {
const redisClient = await this.redis.createClient({
host: REDIS_HOST,
port: REDIS_PORT,
password: process.env.REDIS_PASSWORD,
});
const delAsync = promisify(redisClient.del).bind(redisClient);

View file

@ -384,6 +384,7 @@ class Extension {
const redisClient = redis.createClient({
host: REDIS_HOST,
port: REDIS_PORT,
password: process.env.REDIS_PASSWORD,
});
const delAsync = promisify(redisClient.del).bind(redisClient);
const deleteKey = delAsync(type + id);

View file

@ -217,17 +217,20 @@ class CheckAuth {
// Create Redis client
const redisClient = this.redis.createClient({
socket: {
host: REDIS_HOST,
port: REDIS_PORT,
},
// socket: {
// host: REDIS_HOST,
// port: REDIS_PORT,
// },
host: REDIS_HOST,
port: REDIS_PORT,
password: process.env.REDIS_PASSWORD,
});
redisClient.on("error", (err: any) => {
console.error("[REDIS] Connection error:", err.message);
});
await redisClient.connect();
// await redisClient.connect();
console.log("[REDIS] Connected successfully!");
const getAsync = promisify(redisClient.get).bind(redisClient);

View file

@ -844,6 +844,7 @@ export class ExecuteOrgCommandService {
const redisClient = await redis.createClient({
host: REDIS_HOST,
port: REDIS_PORT,
password: process.env.REDIS_PASSWORD,
});
const delAsync = promisify(redisClient.del).bind(redisClient);

View file

@ -1987,6 +1987,7 @@ async function clearMenuAndRoleCache(): Promise<void> {
const redisClient = redis.createClient({
host: REDIS_HOST,
port: REDIS_PORT,
password: process.env.REDIS_PASSWORD,
});
const keysAsync = promisify(redisClient.keys).bind(redisClient);