From 91208d950d66b034df040426d5a7f7356b040228 Mon Sep 17 00:00:00 2001 From: Kallesh B S Date: Tue, 22 Jul 2025 20:43:57 +0530 Subject: [PATCH] API mod as per 22-07-2025 requested --- .../carnet-application.service.ts | 29 ++++++++++++++++--- .../manage-clients/manage-clients.service.ts | 4 ++- .../param-table/param-table.controller.ts | 3 +- src/oracle/uscib-managed-sp/sp/sp.service.ts | 4 ++- 4 files changed, 33 insertions(+), 7 deletions(-) diff --git a/src/oracle/carnet-application/carnet-application.service.ts b/src/oracle/carnet-application/carnet-application.service.ts index 7d16edb..6e5ffba 100644 --- a/src/oracle/carnet-application/carnet-application.service.ts +++ b/src/oracle/carnet-application/carnet-application.service.ts @@ -966,7 +966,9 @@ export class CarnetApplicationService { throw new InternalServerException("Incomplete data received from the database."); } - return await fetchCursor(outBinds.P_CURSOR, CarnetApplicationService.name); + const fres: any = await fetchCursor(outBinds.P_CURSOR, CarnetApplicationService.name); + + return fres.length > 0 ? fres[0] : []; } catch (error) { handleError(error, CarnetApplicationService.name) } finally { @@ -1001,7 +1003,15 @@ export class CarnetApplicationService { throw new InternalServerException("Incomplete data received from the database."); } - return await fetchCursor(outBinds.P_CURSOR, CarnetApplicationService.name); + + const fres: any = await fetchCursor(outBinds.P_CURSOR, CarnetApplicationService.name); + + // if (fres.length > 0 && fres[0].ERRORMESG) { + // this.logger.warn(fres[0].ERRORMESG); + // throw new BadRequestException(fres[0].ERRORMESG) + // } + + return fres.length > 0 ? fres[0] : []; } catch (error) { handleError(error, CarnetApplicationService.name) } finally { @@ -1035,7 +1045,16 @@ export class CarnetApplicationService { throw new InternalServerException("Incomplete data received from the database."); } - return await fetchCursor(outBinds.P_CURSOR, CarnetApplicationService.name); + const fres: any = await fetchCursor(outBinds.P_CURSOR, CarnetApplicationService.name); + + + + return fres.length > 0 ? + { + NOOFUSSETS: fres[0].NOOFUSSETS, + P_COUNTRYTABLE: fres.map(({ NOOFUSSETS, ...rest }) => rest) + } + : {}; } catch (error) { handleError(error, CarnetApplicationService.name) } finally { @@ -1069,7 +1088,9 @@ export class CarnetApplicationService { throw new InternalServerException("Incomplete data received from the database."); } - return await fetchCursor(outBinds.P_CURSOR, CarnetApplicationService.name); + const fres: any = await fetchCursor(outBinds.P_CURSOR, CarnetApplicationService.name); + + return fres.length > 0 ? fres[0] : []; } catch (error) { handleError(error, CarnetApplicationService.name) } finally { diff --git a/src/oracle/manage-clients/manage-clients.service.ts b/src/oracle/manage-clients/manage-clients.service.ts index 15674d8..b23c322 100644 --- a/src/oracle/manage-clients/manage-clients.service.ts +++ b/src/oracle/manage-clients/manage-clients.service.ts @@ -672,8 +672,10 @@ export class ManageClientsService { this.logger.error('One or more expected cursors are missing from stored procedure output.'); throw new InternalServerException("Incomplete data received from the database."); } + + const fres: any = await fetchCursor(outBinds.P_CURSOR, ManageClientsService.name); - return await fetchCursor(outBinds.P_CURSOR, ManageClientsService.name); + return fres.length > 0 ? fres[0] : []; } catch (error) { handleError(error, ManageClientsService.name) diff --git a/src/oracle/param-table/param-table.controller.ts b/src/oracle/param-table/param-table.controller.ts index e4dfa0d..da96a6a 100644 --- a/src/oracle/param-table/param-table.controller.ts +++ b/src/oracle/param-table/param-table.controller.ts @@ -11,6 +11,7 @@ import { JwtAuthGuard } from 'src/guards/jwt-auth.guard'; import { RolesGuard } from 'src/guards/roles.guard'; @ApiTags('Param Table - Oracle') +@UseGuards(JwtAuthGuard, RolesGuard) @Roles('sa', 'ua') @Controller('oracle') export class ParamTableController { @@ -18,7 +19,6 @@ export class ParamTableController { @Get('/GetParamValues') - @UseGuards(JwtAuthGuard, RolesGuard) @Roles('ca', 'sa', 'ua') @ApiQuery({ name: 'P_SPID', @@ -37,6 +37,7 @@ export class ParamTableController { } @Get('GetCountriesAndMessages') + @Roles('ca', 'sa', 'ua') GET_COUNTRIES_AND_MESSAGES() { return this.paramTableService.GET_COUNTRIES_AND_MESSAGES(); } diff --git a/src/oracle/uscib-managed-sp/sp/sp.service.ts b/src/oracle/uscib-managed-sp/sp/sp.service.ts index 852e5f7..20cc382 100644 --- a/src/oracle/uscib-managed-sp/sp/sp.service.ts +++ b/src/oracle/uscib-managed-sp/sp/sp.service.ts @@ -241,7 +241,9 @@ export class SpService { throw new InternalServerException("Incomplete data received from the database."); } - return await fetchCursor(outBinds.P_CURSOR, SpService.name); + const fres: any = await fetchCursor(outBinds.P_CURSOR, SpService.name); + + return fres.length > 0 ? fres[0] : []; } catch (error) { handleError(error, SpService.name)