updated select response
This commit is contained in:
@@ -20,6 +20,9 @@ ENV NODE_ENV=production
|
||||
|
||||
COPY --from=builder /usr/src/app/dist ./dist
|
||||
COPY --from=builder /usr/src/app/node_modules ./node_modules
|
||||
COPY --from=builder /usr/src/app/package.json ./package.json
|
||||
|
||||
RUN npm prune --production
|
||||
|
||||
USER node
|
||||
|
||||
|
||||
1338
ServicesApi/package-lock.json
generated
1338
ServicesApi/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -46,7 +46,7 @@
|
||||
"@swc/core": "^1.10.7",
|
||||
"@types/express": "^5.0.0",
|
||||
"@types/jest": "^29.5.14",
|
||||
"@types/node": "^22.16.5",
|
||||
"@types/node": "^22.17.0",
|
||||
"@types/supertest": "^6.0.2",
|
||||
"eslint": "^9.18.0",
|
||||
"eslint-config-prettier": "^10.0.1",
|
||||
|
||||
@@ -11,7 +11,7 @@ export class LoginService {
|
||||
private readonly redis: RedisHandlers,
|
||||
private readonly passHandlers: PasswordHandlers,
|
||||
private readonly prisma: PrismaService,
|
||||
) {}
|
||||
) { }
|
||||
|
||||
async run(dto: userLoginValidator) {
|
||||
const foundUser = await this.prisma.users.findFirstOrThrow({
|
||||
@@ -137,14 +137,16 @@ export class LoginService {
|
||||
});
|
||||
selectList = employees;
|
||||
}
|
||||
|
||||
let fullName = `${foundPerson.firstname}`;
|
||||
if (foundPerson.middle_name) fullName += ` ${foundPerson.middle_name}`;
|
||||
if (foundPerson.birthname) fullName += ` ${foundPerson.birthname}`;
|
||||
fullName += ` ${foundPerson.surname}`;
|
||||
const redisData = AuthTokenSchema.parse({
|
||||
people: foundPerson,
|
||||
users: foundUser,
|
||||
credentials: {
|
||||
person_uu_id: foundPerson.uu_id,
|
||||
person_name: foundPerson.firstname,
|
||||
person_full_name: `${foundPerson.firstname} ${foundPerson.middle_name || ''} | ${foundPerson.birthname || ''} | ${foundPerson.surname}`,
|
||||
uuid: foundPerson.uu_id,
|
||||
fullName: fullName,
|
||||
},
|
||||
selectionList: {
|
||||
type: foundUser.user_type,
|
||||
|
||||
@@ -19,7 +19,7 @@ export class SelectService {
|
||||
constructor(
|
||||
private readonly redis: RedisHandlers,
|
||||
private readonly prisma: PrismaService,
|
||||
) {}
|
||||
) { }
|
||||
async run(dto: userSelectValidator, req: Request) {
|
||||
const accessObject = await this.redis.getLoginFromRedis(req);
|
||||
if (!accessObject) {
|
||||
@@ -196,8 +196,6 @@ export class SelectService {
|
||||
company: company,
|
||||
menu: null,
|
||||
pages: null,
|
||||
config: null,
|
||||
caches: null,
|
||||
selection: await this.prisma.build_living_space.findFirstOrThrow({
|
||||
where: { uu_id: dto.uuid },
|
||||
select: {
|
||||
|
||||
@@ -9,9 +9,8 @@ export type UserType = (typeof UserType)[keyof typeof UserType];
|
||||
|
||||
// Credentials
|
||||
export const CredentialsSchema = z.object({
|
||||
person_uu_id: z.string(),
|
||||
person_name: z.string(),
|
||||
full_name: z.string(),
|
||||
uuid: z.string(),
|
||||
fullName: z.string(),
|
||||
});
|
||||
export type Credentials = z.infer<typeof CredentialsSchema>;
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ export class RedisHandlers {
|
||||
constructor(
|
||||
private readonly cacheService: CacheService,
|
||||
private readonly passwordService: PasswordHandlers,
|
||||
) {}
|
||||
) { }
|
||||
|
||||
/**
|
||||
* Validates that a Redis key follows the expected format
|
||||
@@ -125,7 +125,7 @@ export class RedisHandlers {
|
||||
if (parts[1] === parts[2]) {
|
||||
const value = await this.cacheService.get(key);
|
||||
if (value) {
|
||||
return { key, value };
|
||||
return { key: value.key, value: value.value };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user