import { Body, Controller, Get, Param, ParseIntPipe, Patch, Post, Put, Query, UsePipes } from '@nestjs/common'; import { OracleService } from './oracle.service'; 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, ApiPropertyOptional, ApiQuery, ApiTags } from '@nestjs/swagger'; @Controller('oracle') export class OracleController { constructor( private readonly oarcleService: OracleService, private readonly paramTableService: ParamTableService, private readonly manageFeeService: ManageFeeService) { } // Regions @ApiTags('Regions - Oracle') @Post('/InsertRegions') insertRegions(@Body() body: InsertRegionsDto) { return this.oarcleService.insertRegions(body.p_region, body.p_name); } @ApiTags('Regions - Oracle') @Patch('/UpdateRegion') updateRegions(@Body() body: UpdateRegionDto) { return this.oarcleService.updateRegions(body.p_regionID, body.p_name); } @ApiTags('Regions - Oracle') @Get('/GetRegions') getRegions() { return this.oarcleService.getRegions(); } // Service Provider [ SP ] @ApiTags('SP - Oracle') @Post('/InsertNewServiceProvider') insertNewServiceProvider(@Body() body: InsertNewServiceProviderDTO) { return this.oarcleService.insertNewServiceProvider( body.p_name, body.p_lookupcode, body.p_address1, body.p_address2, body.p_city, body.p_state, body.p_zip, body.p_country, body.p_issuingregion, body.p_replacementregion, body.p_bondsurety, body.p_cargopolicyno, body.p_cargosurety, body.p_user_id ) } @ApiTags('SP - Oracle') @Put('/UpdateServiceProvider') updateServiceProider(@Body() body: UpdateServiceProviderDTO) { return this.oarcleService.updateServiceProvider( body.p_spid, body.p_name, body.p_lookupcode, body.p_address1, body.p_address2, body.p_city, body.p_state, body.p_zip, body.p_country, body.p_issuingregion, body.p_replacementregion, body.p_bondsurety, body.p_cargopolicyno, body.p_cargosurety, body.p_user_id ) } @ApiTags('SP - Oracle') @Get('/GetAllServiceproviders') getAllServiceproviders() { return this.oarcleService.getAllServiceproviders(); } @ApiTags('SP - Oracle') @Get('/GetSelectedServiceprovider/:id') getSelectedServiceprovider(@Param('id', ParseIntPipe) id: number) { return this.oarcleService.getServiceproviderByID(id); } // SPContacts @ApiTags('SPContacts - Oracle') @Post('/InsertSPContacts') insertSPContacts(@Body() body: InsertSPContactsDTO) { return this.oarcleService.insertSPContacts( body.p_spid, body.p_defcontactflag, body.p_firstname, body.p_lastname, body.p_title, body.p_phoneno, body.p_mobileno, body.p_faxno, body.p_emailaddress, body.p_user_id ) } @ApiTags('SPContacts - Oracle') @Post('/SetSPDefaultcontact/:id') setSPDefaultcontact(@Param('id', ParseIntPipe) id: number) { return this.oarcleService.setSPDefaultcontact(id) } @ApiTags('SPContacts - Oracle') @Put('/UpdateSPContacts') updateSPContacts(@Body() body: UpdateSPContactsDTO) { return this.oarcleService.updateSPContacts( body.p_spcontactid, body.p_firstname, body.p_lastname, body.p_title, body.p_phoneno, body.p_mobileno, body.p_faxno, body.p_emailaddress, body.p_user_id ) } @ApiTags('SPContacts - Oracle') @Post('/InactivateSPContact/:id') inactivateSPContact(@Param('id', ParseIntPipe) id: number) { return this.oarcleService.inactivateSPContact(id) } @ApiTags('SPContacts - Oracle') @Get('/GetSPDefaultcontact/:id') getSPDefaultcontact(@Param('id', ParseIntPipe) id: number) { return this.oarcleService.getSPDefaultcontacts(id) } // @Get('/GetAllSPcontacts') // getSPcontacts() { // return this.oarcleService.getSPcontacts(); // } // Carnet Sequence @ApiTags('Carnet Sequence - Oracle') @Post('/CreateCarnetSequence/') createCarnetSequence(@Body() body: CreateCarnetSequenceDTO) { return this.oarcleService.createCarnetSequence( body.p_spid, body.p_regionid, body.p_startnumber, body.p_endnumber, body.p_carnettype ) } @ApiTags('Carnet Sequence - Oracle') @Get('/GetCarnetSequence/:id') getCarnetSequence(@Param('id', ParseIntPipe) id: number) { return this.oarcleService.getCarnetSequence(id) } // param table @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 ) { return this.paramTableService.GETPARAMVALUES(id ? Number(id) : undefined, type); } @ApiTags('Param Table - Oracle') @Post('/CreateTableRecord') createTableRecord(@Body() body: CreateTableRecordDTO) { return this.paramTableService.CREATETABLERECORD(body.P_USERID, body.P_TABLEFULLDESC) } @ApiTags('Param Table - Oracle') @Post('/CreateParamRecord') createParamRecord(@Body() body: CreateParamRecordDTO) { return this.paramTableService.CREATEPARAMRECORD( body.P_PARAMTYPE, body.P_PARAMDESC, body.P_PARAMVALUE, body.P_SORTSEQ, body.P_USERID, body.P_SPID, body.P_ADDLPARAMVALUE1, body.P_ADDLPARAMVALUE2, body.P_ADDLPARAMVALUE3, body.P_ADDLPARAMVALUE4, body.P_ADDLPARAMVALUE5, ) } @ApiTags('Param Table - Oracle') @Patch('/UpdateParamRecord') UpdateParamRecord(@Body() body: UpdateParamRecordDTO) { return this.paramTableService.UPDATEPARAMRECORD(body) } @ApiTags('Param Table - Oracle') @Put('/InActivateParamRecord') inActivateParamRecord(@Body() body: ActivateOrInactivateParamRecordDTO) { return this.paramTableService.INACTIVATEPARAMRECORD(body) } @ApiTags('Param Table - Oracle') @Put('/ReActivateParamRecord') reActivateParamRecord(@Body() body: ActivateOrInactivateParamRecordDTO) { return this.paramTableService.REACTIVATEPARAMRECORD(body) } // ManageFee @ApiTags('Manage Fee - Oracle') @Post('/CreateBasicFee') CreateBasicFee(@Body() body: CreateBasicFeeDTO) { return this.manageFeeService.CREATEBASICFEE(body) } @ApiTags('Manage Fee - Oracle') @Post('/CreateBondRate') CreateBondRate(@Body() body: CreateBondRateDTO) { return this.manageFeeService.CREATEBONDRATE(body) } @ApiTags('Manage Fee - Oracle') @Post('/CreateCargoRate') CreateCargoRate(@Body() body: CreateCargoRateDTO) { return this.manageFeeService.CREATECARGORATE(body) } @ApiTags('Manage Fee - Oracle') @Post('/CreateCfFee') CreateCfFee(@Body() body: CreateCfFeeDTO) { return this.manageFeeService.CREATECFFEE(body) } @ApiTags('Manage Fee - Oracle') @Post('/CreateCsFee') CreateCsFee(@Body() body: CreateCsFeeDTO) { return this.manageFeeService.CREATECSFEE(body) } @ApiTags('Manage Fee - Oracle') @Post('/CreateEfFee') CreateEeFee(@Body() body: CreateEfFeeDTO) { return this.manageFeeService.CREATEEFFEE(body) } @ApiTags('Manage Fee - Oracle') @Post('/CreateFeeComm') CreateFeeComm(@Body() body: CreateFeeCommDTO) { return this.manageFeeService.CREATEFEECOMM(body) } @ApiTags('Manage Fee - Oracle') @Patch('/UpdateBasicFee') UpdateBasicFee(@Body() body: UpdateBasicFeeDTO) { return this.manageFeeService.UPDATEBASICFEE(body) } @ApiTags('Manage Fee - Oracle') @Patch('/UpdateBondRate') UpdateBondRate(@Body() body: UpdateBondRateDTO) { return this.manageFeeService.UPDATEBONDRATE(body) } @ApiTags('Manage Fee - Oracle') @Patch('/UpdateCargoRate') UpdateCargoRate(@Body() body: UpdateCargoRateDTO) { return this.manageFeeService.UPDATECARGORATE(body) } @ApiTags('Manage Fee - Oracle') @Patch('/UpdateCfFee') UpdateCfFee(@Body() body: UpdateCfFeeDTO) { return this.manageFeeService.UPDATECFFEE(body) } @ApiTags('Manage Fee - Oracle') @Patch('/UpdateCsFee') UpdateCsFee(@Body() body: UpdateCsFeeDTO) { return this.manageFeeService.UPDATECSFEE(body) } @ApiTags('Manage Fee - Oracle') @Patch('/UpdateEfFee') UpdateEfFee(@Body() body: UpdateEfFeeDTO) { return this.manageFeeService.UPDATEEFFEE(body) } @ApiTags('Manage Fee - Oracle') @Patch('/UpdateFeeComm') UpdateFeeComm(@Body() body: UpdateFeeCommDTO) { return this.manageFeeService.UPDATEFEECOMM(body) } @ApiTags('Manage Fee - Oracle') @Get('/GetBasicFeeRates/:id') GetBasicFeeRates(@Param('id', ParseIntPipe) id: number) { return this.manageFeeService.GETBASICFEERATES(id) } @ApiTags('Manage Fee - Oracle') @Get('/GetBondRates/:id') GetBondRates( @Param('id', ParseIntPipe) id: number) { return this.manageFeeService.GETBONDRATES(id) } @ApiTags('Manage Fee - Oracle') @Get('/GetCargoRates/:id') GetCargoRates( @Param('id', ParseIntPipe) id: number) { return this.manageFeeService.GETCARGORATES(id) } @ApiTags('Manage Fee - Oracle') @Get('/GetCfFeeRates/:id') GetCfFeeRates( @Param('id', ParseIntPipe) id: number) { return this.manageFeeService.GETCFFEERATES(id) } @ApiTags('Manage Fee - Oracle') @Get('/GetCsFeeRates/:id') GetCsFeeRates( @Param('id', ParseIntPipe) id: number) { return this.manageFeeService.GETCSFEERATES(id) } @ApiTags('Manage Fee - Oracle') @Get('/GetEfFeeRates/:id') GetEfFeeRates( @Param('id', ParseIntPipe) id: number) { return this.manageFeeService.GETEFFEERATES(id) } @ApiTags('Manage Fee - Oracle') @Get('/GetFeeComm/:id') GetFeeComm( @Param('id', ParseIntPipe) id: number) { return this.manageFeeService.GETFEECOMM(id) } }