modified responses and error handling for oracle api

This commit is contained in:
Kallesh B S 2025-05-16 15:32:20 +05:30
parent 2413ba955e
commit 1e0e177fd0
8 changed files with 963 additions and 957 deletions

View File

@ -8,58 +8,58 @@ export class ManageFeeController {
constructor(private readonly manageFeeService: ManageFeeService) { } constructor(private readonly manageFeeService: ManageFeeService) { }
// @ApiTags('Manage Fee - Mssql') @ApiTags('Manage Fee - Mssql')
// @Get('/GetBasicFeeRates') @Get('/GetBasicFeeRates')
GetBasicFeeRates(@Query() body: GetFeeGeneralDTO) { GetBasicFeeRates(@Query() body: GetFeeGeneralDTO) {
return this.manageFeeService.GETBASICFEERATES(body); return this.manageFeeService.GETBASICFEERATES(body);
} }
// @ApiTags('Manage Fee - Mssql') @ApiTags('Manage Fee - Mssql')
// @Post('/CreateBasicFee') @Post('/CreateBasicFee')
CreateBasicFee(@Body() body: CreateBasicFeeDTO) { CreateBasicFee(@Body() body: CreateBasicFeeDTO) {
return this.manageFeeService.CREATEBASICFEE(body); return this.manageFeeService.CREATEBASICFEE(body);
} }
// @ApiTags('Manage Fee - Mssql') @ApiTags('Manage Fee - Mssql')
// @Patch('/UpdateBasicFee') @Patch('/UpdateBasicFee')
UpdateBasicFee(@Body() body: UpdateBasicFeeDTO) { UpdateBasicFee(@Body() body: UpdateBasicFeeDTO) {
return this.manageFeeService.UPDATEBASICFEE(body); return this.manageFeeService.UPDATEBASICFEE(body);
} }
// @ApiTags('Manage Fee - Mssql') @ApiTags('Manage Fee - Mssql')
// @Get('/GetBondRates') @Get('/GetBondRates')
GetBondRates(@Query() body: GetFeeGeneralDTO) { GetBondRates(@Query() body: GetFeeGeneralDTO) {
return this.manageFeeService.GETBONDRATES(body); return this.manageFeeService.GETBONDRATES(body);
} }
// @ApiTags('Manage Fee - Mssql') @ApiTags('Manage Fee - Mssql')
// @Post('/CreateBondRate') @Post('/CreateBondRate')
CreateBondRate(@Body() body: CreateBondRateDTO) { CreateBondRate(@Body() body: CreateBondRateDTO) {
return this.manageFeeService.CREATEBONDRATE(body); return this.manageFeeService.CREATEBONDRATE(body);
} }
// @ApiTags('Manage Fee - Mssql') @ApiTags('Manage Fee - Mssql')
// @Patch('/UpdateBondRate') @Patch('/UpdateBondRate')
UpdateBondRate(@Body() body: UpdateBondRateDTO) { UpdateBondRate(@Body() body: UpdateBondRateDTO) {
return this.manageFeeService.UPDATEBONDRATE(body); return this.manageFeeService.UPDATEBONDRATE(body);
} }
// Cargo Rate // Cargo Rate
// @ApiTags('Manage Fee - Mssql') @ApiTags('Manage Fee - Mssql')
// @Get('/GetCargoRates') @Get('/GetCargoRates')
GetCargoRates(@Query() body: GetFeeGeneralDTO) { GetCargoRates(@Query() body: GetFeeGeneralDTO) {
return this.manageFeeService.GETCARGORATES(body); return this.manageFeeService.GETCARGORATES(body);
} }
// @ApiTags('Manage Fee - Mssql') @ApiTags('Manage Fee - Mssql')
// @Post('/CreateCargoRate') @Post('/CreateCargoRate')
CreateCargoRate(@Body() body: CreateCargoRateDTO) { CreateCargoRate(@Body() body: CreateCargoRateDTO) {
return this.manageFeeService.CREATECARGORATE(body); return this.manageFeeService.CREATECARGORATE(body);
} }
// @ApiTags('Manage Fee - Mssql') @ApiTags('Manage Fee - Mssql')
// @Patch('/UpdateCargoRate') @Patch('/UpdateCargoRate')
UpdateCargoRate(@Body() body: UpdateCargoRateDTO) { UpdateCargoRate(@Body() body: UpdateCargoRateDTO) {
return this.manageFeeService.UPDATECARGORATE(body); return this.manageFeeService.UPDATECARGORATE(body);
} }

View File

@ -325,7 +325,7 @@ export class ManageClientsService {
// throw new Error('No cursor returned from the stored procedure'); // throw new Error('No cursor returned from the stored procedure');
// } // }
if (p_clientcursor_rows[0].ERRORMESG) { if (p_clientcursor_rows.length>0 && p_clientcursor_rows[0].ERRORMESG) {
throw new BadRequestException(p_clientcursor_rows[0].ERRORMESG); throw new BadRequestException(p_clientcursor_rows[0].ERRORMESG);
} }
@ -477,7 +477,7 @@ export class ManageClientsService {
throw new Error('No cursor returned from the stored procedure'); throw new Error('No cursor returned from the stored procedure');
} }
if (p_cursor_rows[0].ERRORMESG) { if (p_cursor_rows.length>0 && p_cursor_rows[0].ERRORMESG) {
throw new BadRequestException(p_cursor_rows[0].ERRORMESG); throw new BadRequestException(p_cursor_rows[0].ERRORMESG);
} }
@ -629,7 +629,7 @@ export class ManageClientsService {
throw new Error('No cursor returned from the stored procedure'); throw new Error('No cursor returned from the stored procedure');
} }
if (p_cursor_rows[0].ERRORMESG) { if (p_cursor_rows.length>0 && p_cursor_rows[0].ERRORMESG) {
throw new BadRequestException(p_cursor_rows[0].ERRORMESG); throw new BadRequestException(p_cursor_rows[0].ERRORMESG);
} }
@ -774,7 +774,7 @@ export class ManageClientsService {
throw new Error('No cursor returned from the stored procedure'); throw new Error('No cursor returned from the stored procedure');
} }
if (p_cursor_rows[0].ERRORMESG) { if (p_cursor_rows.length>0 && p_cursor_rows[0].ERRORMESG) {
throw new BadRequestException(p_cursor_rows[0].ERRORMESG); throw new BadRequestException(p_cursor_rows[0].ERRORMESG);
} }
@ -950,7 +950,7 @@ export class ManageClientsService {
throw new InternalServerException('No cursor returned from the stored procedure'); throw new InternalServerException('No cursor returned from the stored procedure');
} }
if (p_cursor_rows[0].ERRORMESG) { if (p_cursor_rows.length>0 && p_cursor_rows[0].ERRORMESG) {
throw new BadRequestException(p_cursor_rows[0].ERRORMESG); throw new BadRequestException(p_cursor_rows[0].ERRORMESG);
} }
@ -1119,7 +1119,7 @@ export class ManageClientsService {
throw new Error('No cursor returned from the stored procedure'); throw new Error('No cursor returned from the stored procedure');
} }
if (p_cursor_rows[0].ERRORMESG) { if (p_cursor_rows.length>0 && p_cursor_rows[0].ERRORMESG) {
throw new BadRequestException(p_cursor_rows[0].ERRORMESG); throw new BadRequestException(p_cursor_rows[0].ERRORMESG);
} }

File diff suppressed because it is too large Load Diff

View File

@ -126,12 +126,12 @@ export class ParamTableService {
const fres = await result.outBinds.p_cursor.getRows(); const fres = await result.outBinds.p_cursor.getRows();
if (fres[0].ERRORMESG) { if (fres.length>0 && fres[0].ERRORMESG) {
this.logger.warn(fres[0].ERRORMESG); this.logger.warn(fres[0].ERRORMESG);
throw new BadRequestException(fres[0].ERRORMESG) throw new BadRequestException(fres[0].ERRORMESG)
} }
return fres; return { statusCode: 201, message: "Createdted Successfully", ...fres[0] };
} catch (error) { } catch (error) {
if (error instanceof BadRequestException) { if (error instanceof BadRequestException) {
this.logger.warn(error.message); this.logger.warn(error.message);
@ -233,12 +233,12 @@ export class ParamTableService {
const fres = await result.outBinds.p_cursor.getRows(); const fres = await result.outBinds.p_cursor.getRows();
if (fres[0].ERRORMESG) { if (fres.length>0 && fres[0].ERRORMESG) {
this.logger.warn(fres[0].ERRORMESG); this.logger.warn(fres[0].ERRORMESG);
throw new BadRequestException(fres[0].ERRORMESG) throw new BadRequestException(fres[0].ERRORMESG)
} }
return fres; return { statusCode: 201, message: "Createdted Successfully", ...fres[0] };
} catch (error) { } catch (error) {
if (error instanceof BadRequestException) { if (error instanceof BadRequestException) {
throw error; throw error;
@ -337,12 +337,12 @@ export class ParamTableService {
const fres = await result.outBinds.p_cursor.getRows(); const fres = await result.outBinds.p_cursor.getRows();
if (fres[0].ERRORMESG) { if (fres.length>0 && fres[0].ERRORMESG) {
this.logger.warn(fres[0].ERRORMESG); this.logger.warn(fres[0].ERRORMESG);
throw new BadRequestException(fres[0].ERRORMESG) throw new BadRequestException(fres[0].ERRORMESG)
} }
return fres; return { statusCode: 200, message: "Updated Successfully", ...fres[0] };
} catch (error) { } catch (error) {
if (error instanceof BadRequestException) { if (error instanceof BadRequestException) {
this.logger.warn(error.message); this.logger.warn(error.message);

View File

@ -70,12 +70,12 @@ export class CarnetSequenceService {
await result.outBinds.p_cursor.close(); await result.outBinds.p_cursor.close();
if (fres[0].ERRORMESG) { if (fres.length>0 && fres[0].ERRORMESG) {
this.logger.warn(fres[0].ERRORMESG); this.logger.warn(fres[0].ERRORMESG);
throw new BadRequestException(fres[0].ERRORMESG) throw new BadRequestException(fres[0].ERRORMESG)
} }
return fres; return { statusCode: 201, message: "Createdted Successfully", ...fres[0] };
} catch (error) { } catch (error) {
if (error instanceof BadRequestException) { if (error instanceof BadRequestException) {
this.logger.warn(error.message); this.logger.warn(error.message);

View File

@ -129,12 +129,12 @@ export class RegionService {
const fres = await result.outBinds.p_cursor.getRows(); const fres = await result.outBinds.p_cursor.getRows();
if (fres[0].ERRORMESG) { if (fres.length>0 && fres[0].ERRORMESG) {
this.logger.warn(fres[0].ERRORMESG); this.logger.warn(fres[0].ERRORMESG);
throw new BadRequestException(fres[0].ERRORMESG) throw new BadRequestException(fres[0].ERRORMESG)
} }
return fres; return { statusCode: 201, message: "Createdted Successfully", ...fres[0] };
} catch (error) { } catch (error) {
if (error instanceof BadRequestException) { if (error instanceof BadRequestException) {
this.logger.warn(error.message); this.logger.warn(error.message);
@ -188,12 +188,12 @@ export class RegionService {
const fres = await result.outBinds.p_cursor.getRows(); const fres = await result.outBinds.p_cursor.getRows();
if (fres[0].ERRORMESG) { if (fres.length>0 && fres[0].ERRORMESG) {
this.logger.warn(fres[0].ERRORMESG); this.logger.warn(fres[0].ERRORMESG);
throw new BadRequestException(fres[0].ERRORMESG) throw new BadRequestException(fres[0].ERRORMESG)
} }
return fres; return { statusCode: 200, message: "Updated Successfully", ...fres[0] };
} catch (error) { } catch (error) {
if (error instanceof BadRequestException) { if (error instanceof BadRequestException) {
this.logger.warn(error.message); this.logger.warn(error.message);

View File

@ -101,7 +101,7 @@ export class SpContactsService {
const fres = await result.outBinds.p_cursor.getRows(); const fres = await result.outBinds.p_cursor.getRows();
if (fres[0].ERRORMESG) { if (fres.length>0 && fres[0].ERRORMESG) {
this.logger.warn(fres[0].ERRORMESG); this.logger.warn(fres[0].ERRORMESG);
throw new BadRequestException(fres[0].ERRORMESG) throw new BadRequestException(fres[0].ERRORMESG)
} }
@ -239,7 +239,7 @@ export class SpContactsService {
const fres = await result.outBinds.p_cursor.getRows(); const fres = await result.outBinds.p_cursor.getRows();
if (fres[0].ERRORMESG) { if (fres.length>0 && fres[0].ERRORMESG) {
this.logger.warn(fres[0].ERRORMESG); this.logger.warn(fres[0].ERRORMESG);
throw new BadRequestException(fres[0].ERRORMESG) throw new BadRequestException(fres[0].ERRORMESG)
} }

View File

@ -124,7 +124,8 @@ export class SpService {
const fres = await result.outBinds.p_cursor.getRows(); const fres = await result.outBinds.p_cursor.getRows();
if (fres[0].ERRORMESG) { if (fres.length>0 && fres[0].ERRORMESG) {
this.logger.warn(fres[0].ERRORMESG);
throw new BadRequestException(fres[0].ERRORMESG) throw new BadRequestException(fres[0].ERRORMESG)
} }
@ -296,7 +297,8 @@ export class SpService {
const fres = await result.outBinds.p_cursor.getRows(); const fres = await result.outBinds.p_cursor.getRows();
if (fres[0].ERRORMESG) { if (fres.length>0 && fres[0].ERRORMESG) {
this.logger.warn(fres[0].ERRORMESG);
throw new BadRequestException(fres[0].ERRORMESG) throw new BadRequestException(fres[0].ERRORMESG)
} }