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');