From a82ef35a005e4f9f9b183b411ce372599029fe8b Mon Sep 17 00:00:00 2001 From: Kallesh B S Date: Fri, 7 Mar 2025 13:35:13 +0530 Subject: [PATCH] swagger updated --- src/oracle/oracle.controller.ts | 19 ++++++++++--------- src/oracle/oracle.dto.ts | 11 +++++++++++ src/oracle/paramTable.service.ts | 14 +++++++------- 3 files changed, 28 insertions(+), 16 deletions(-) diff --git a/src/oracle/oracle.controller.ts b/src/oracle/oracle.controller.ts index 1f6312e..7d568ef 100644 --- a/src/oracle/oracle.controller.ts +++ b/src/oracle/oracle.controller.ts @@ -1,9 +1,9 @@ import { Body, Controller, Get, Param, ParseIntPipe, Patch, Post, Put, Query, UsePipes } from '@nestjs/common'; import { OracleService } from './oracle.service'; -import { CreateBasicFeeDTO, CreateBondRateDTO, CreateCargoRateDTO, CreateCarnetSequenceDTO, CreateCfFeeDTO, CreateCsFeeDTO, CreateEfFeeDTO, CreateFeeCommDTO, CreateParamRecordDTO, CreateTableRecordDTO, InsertNewServiceProviderDTO, InsertRegionsDto, InsertSPContactsDTO, UpdateBasicFeeDTO, UpdateBondRateDTO, UpdateCargoRateDTO, UpdateCfFeeDTO, UpdateCsFeeDTO, UpdateEfFeeDTO, UpdateFeeCommDTO, UpdateParamRecordDTO, UpdateRegionDto, UpdateServiceProviderDTO, UpdateSPContactsDTO } from './oracle.dto'; +import { ActivateOrInactivateParamRecordDTO, CreateBasicFeeDTO, CreateBondRateDTO, CreateCargoRateDTO, CreateCarnetSequenceDTO, CreateCfFeeDTO, CreateCsFeeDTO, CreateEfFeeDTO, CreateFeeCommDTO, CreateParamRecordDTO, CreateTableRecordDTO, InsertNewServiceProviderDTO, InsertRegionsDto, InsertSPContactsDTO, UpdateBasicFeeDTO, UpdateBondRateDTO, UpdateCargoRateDTO, UpdateCfFeeDTO, UpdateCsFeeDTO, UpdateEfFeeDTO, UpdateFeeCommDTO, UpdateParamRecordDTO, UpdateRegionDto, UpdateServiceProviderDTO, UpdateSPContactsDTO } from './oracle.dto'; import { ParamTableService } from './paramTable.service'; import { ManageFeeService } from './manageFee.service'; -import { ApiOperation, ApiTags } from '@nestjs/swagger'; +import { ApiOperation, ApiPropertyOptional, ApiQuery, ApiTags } from '@nestjs/swagger'; @Controller('oracle') export class OracleController { @@ -173,6 +173,8 @@ export class OracleController { @ApiTags('Param Table - Oracle') @Get('/GetParamValues') @UsePipes() + @ApiQuery({ name: 'id', required: false, type: Number, description: 'The ID of the parameter' }) + @ApiQuery({ name: 'type', required: false, type: String, description: 'The type of the parameter' }) getParamValues( @Query('id') id: string, @Query('type') type: string @@ -211,16 +213,15 @@ export class OracleController { } @ApiTags('Param Table - Oracle') - @Patch('/InActivateParamRecord') - inActivateParamRecord(@Query('pid') pid,@Query('uid') uid) { - return this.paramTableService.INACTIVATEPARAMRECORD(pid?Number(pid):pid,uid) + @Put('/InActivateParamRecord') + inActivateParamRecord(@Body() body: ActivateOrInactivateParamRecordDTO) { + return this.paramTableService.INACTIVATEPARAMRECORD(body) } @ApiTags('Param Table - Oracle') - @Patch('/ReActivateParamRecord') - @ApiOperation({ summary: 'Retrieve all users', description: 'This endpoint returns a list of all users.' }) - reActivateParamRecord(@Query('pid') pid,@Query('uid') uid) { - return this.paramTableService.REACTIVATEPARAMRECORD(pid?Number(pid):pid,uid) + @Put('/ReActivateParamRecord') + reActivateParamRecord(@Body() body: ActivateOrInactivateParamRecordDTO) { + return this.paramTableService.REACTIVATEPARAMRECORD(body) } diff --git a/src/oracle/oracle.dto.ts b/src/oracle/oracle.dto.ts index ef186e7..a8ddcdb 100644 --- a/src/oracle/oracle.dto.ts +++ b/src/oracle/oracle.dto.ts @@ -698,4 +698,15 @@ export class UpdateFeeCommDTO { @ApiProperty({ required: true }) @IsString() P_USERID: string; +} + +export class ActivateOrInactivateParamRecordDTO{ + + @ApiProperty({required:true}) + @IsNumber() + P_PARAMID:number; + + @ApiProperty({required:true}) + @IsString() + P_USERID:string; } \ No newline at end of file diff --git a/src/oracle/paramTable.service.ts b/src/oracle/paramTable.service.ts index feffc04..c298813 100644 --- a/src/oracle/paramTable.service.ts +++ b/src/oracle/paramTable.service.ts @@ -1,7 +1,7 @@ import { Injectable } from '@nestjs/common'; import { OracleDBService } from 'src/db/db.service'; import * as oracledb from 'oracledb' -import { UpdateParamRecordDTO } from './oracle.dto'; +import { ActivateOrInactivateParamRecordDTO, UpdateParamRecordDTO } from './oracle.dto'; @Injectable() export class ParamTableService { @@ -301,7 +301,7 @@ export class ParamTableService { } finally { } } - async INACTIVATEPARAMRECORD(P_PARAMID: number, P_USERID: string) { + async INACTIVATEPARAMRECORD(body:ActivateOrInactivateParamRecordDTO) { let connection; try { // Connect to the Oracle database using oracledb @@ -318,11 +318,11 @@ export class ParamTableService { END;`, { P_PARAMID: { - val: P_PARAMID, + val: body.P_PARAMID, type: oracledb.DB_TYPE_NUMBER }, P_USERID: { - val: P_USERID, + val: body.P_USERID, type: oracledb.DB_TYPE_VARCHAR }, } @@ -338,7 +338,7 @@ export class ParamTableService { } finally { } } - async REACTIVATEPARAMRECORD(P_PARAMID: number, P_USERID: string) { + async REACTIVATEPARAMRECORD(body:ActivateOrInactivateParamRecordDTO) { let connection; try { // Connect to the Oracle database using oracledb @@ -355,11 +355,11 @@ export class ParamTableService { END;`, { P_PARAMID: { - val: P_PARAMID, + val: body.P_PARAMID, type: oracledb.DB_TYPE_NUMBER }, P_USERID: { - val: P_USERID, + val: body.P_USERID, type: oracledb.DB_TYPE_VARCHAR }, },