From 570037c6d92f0bec3e62a5d3f2ca5ded810e8d2d Mon Sep 17 00:00:00 2001 From: Kallesh B S Date: Sat, 27 Sep 2025 18:21:36 +0530 Subject: [PATCH] auth fix 7 --- .../carnet-application.service.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/pg/carnet-application/carnet-application.service.ts b/src/pg/carnet-application/carnet-application.service.ts index a4cda4a..7a4c0dc 100644 --- a/src/pg/carnet-application/carnet-application.service.ts +++ b/src/pg/carnet-application/carnet-application.service.ts @@ -804,7 +804,7 @@ export class CarnetApplicationService { await client.query(`CLOSE ${cursorName}`); await client.query('COMMIT'); - return toUpperCaseKeys(fetchResult.rows); + return toUpperCaseKeys(fetchResult.rows)[0] ?? []; } catch (error) { if (client) await client.query('ROLLBACK'); @@ -1088,7 +1088,16 @@ export class CarnetApplicationService { await client.query(`CLOSE ${cursorName}`); await client.query('COMMIT'); - return toUpperCaseKeys(fetchResult.rows)[0] ?? []; + let fres = toUpperCaseKeys(fetchResult.rows); + + // return toUpperCaseKeys(fetchResult.rows)[0] ?? []; + + return fres.length > 0 ? + { + NOOFUSSETS: fres[0].NOOFUSSETS, + P_COUNTRYTABLE: fres.map(({ NOOFUSSETS, ...rest }) => rest) + } + : {}; } catch (error) { if (client) await client.query('ROLLBACK'); @@ -1691,7 +1700,7 @@ export class CarnetApplicationService { await client.query(`CLOSE ${cursorName}`); await client.query('COMMIT'); - return toUpperCaseKeys(fetchResult.rows)[0] ?? []; + return toUpperCaseKeys(fetchResult.rows)[0] ?? {}; } catch (error) { if (client) await client.query('ROLLBACK');