Merge branch 'develop'
This commit is contained in:
commit
d1d6ae1b0d
3 changed files with 37 additions and 5 deletions
|
|
@ -2188,6 +2188,7 @@ export class DevelopmentController extends Controller {
|
||||||
position: x.plannedGoalPositions.map((y) => ({
|
position: x.plannedGoalPositions.map((y) => ({
|
||||||
id: y.id,
|
id: y.id,
|
||||||
position: y.position,
|
position: y.position,
|
||||||
|
posExecutive: y.posExecutive,
|
||||||
posTypeId: y.posTypePlannedId,
|
posTypeId: y.posTypePlannedId,
|
||||||
posType: y.posTypePlanned == null ? null : y.posTypePlanned.posTypeName,
|
posType: y.posTypePlanned == null ? null : y.posTypePlanned.posTypeName,
|
||||||
posLevelId: y.posLevelPlannedId,
|
posLevelId: y.posLevelPlannedId,
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,13 @@ export class PlannedGoalPosition extends EntityBase {
|
||||||
})
|
})
|
||||||
position: string;
|
position: string;
|
||||||
|
|
||||||
|
@Column({
|
||||||
|
nullable: true,
|
||||||
|
comment: "ตำแหน่งทางการบริหาร",
|
||||||
|
default: null,
|
||||||
|
})
|
||||||
|
posExecutive: string;
|
||||||
|
|
||||||
@Column({
|
@Column({
|
||||||
nullable: true,
|
nullable: true,
|
||||||
comment: "ประเภทตำแหน่ง",
|
comment: "ประเภทตำแหน่ง",
|
||||||
|
|
@ -51,6 +58,8 @@ export class CreatePlannedGoalPosition {
|
||||||
@Column()
|
@Column()
|
||||||
position: string | null;
|
position: string | null;
|
||||||
@Column()
|
@Column()
|
||||||
|
posExecutive: string | null;
|
||||||
|
@Column()
|
||||||
posTypePlannedId: string | null;
|
posTypePlannedId: string | null;
|
||||||
@Column()
|
@Column()
|
||||||
posLevelPlannedId: string | null;
|
posLevelPlannedId: string | null;
|
||||||
|
|
|
||||||
|
|
@ -184,12 +184,34 @@ class CheckAuth {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
public async checkOrg(token: any, keycloakId: string) {
|
public async checkOrg(token: any, keycloakId: string) {
|
||||||
const redisClient = await this.redis.createClient({
|
|
||||||
host: process.env.REDIS_HOST,
|
|
||||||
port: process.env.REDIS_PORT,
|
|
||||||
});
|
|
||||||
const getAsync = promisify(redisClient.get).bind(redisClient);
|
|
||||||
try {
|
try {
|
||||||
|
// Validate required environment variables
|
||||||
|
const REDIS_HOST = process.env.REDIS_HOST;
|
||||||
|
const REDIS_PORT = process.env.REDIS_PORT ? Number(process.env.REDIS_PORT) : 6379;
|
||||||
|
|
||||||
|
if (!REDIS_HOST) {
|
||||||
|
throw new Error("REDIS_HOST is not set in environment variables");
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(`[REDIS] Connecting to Redis at ${REDIS_HOST}:${REDIS_PORT}`);
|
||||||
|
|
||||||
|
// Create Redis client
|
||||||
|
const redisClient = this.redis.createClient({
|
||||||
|
socket: {
|
||||||
|
host: REDIS_HOST,
|
||||||
|
port: REDIS_PORT,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
redisClient.on("error", (err: any) => {
|
||||||
|
console.error("[REDIS] Connection error:", err.message);
|
||||||
|
});
|
||||||
|
|
||||||
|
await redisClient.connect();
|
||||||
|
console.log("[REDIS] Connected successfully!");
|
||||||
|
|
||||||
|
const getAsync = promisify(redisClient.get).bind(redisClient);
|
||||||
|
|
||||||
let reply = await getAsync("org_" + keycloakId);
|
let reply = await getAsync("org_" + keycloakId);
|
||||||
if (reply != null) {
|
if (reply != null) {
|
||||||
reply = JSON.parse(reply);
|
reply = JSON.parse(reply);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue