447 lines
15 KiB
TypeScript
447 lines
15 KiB
TypeScript
import { BadRequestException, 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, GetCarnetDetailsbyCarnetStatusDTO, InsertNewServiceProviderDTO, InsertRegionsDto, InsertSPContactsDTO, SaveCarnetApplicationDTO, TestDTO, TransmitApplicationtoProcessDTO, UpdateBasicFeeDTO, UpdateBondRateDTO, UpdateCargoRateDTO, UpdateCfFeeDTO, UpdateCsFeeDTO, UpdateEfFeeDTO, UpdateFeeCommBodyDTO, 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';
|
|
import { HomePageDataService } from './homePageData.service';
|
|
|
|
@Controller('oracle')
|
|
export class OracleController {
|
|
constructor(
|
|
private readonly oarcleService: OracleService,
|
|
private readonly paramTableService: ParamTableService,
|
|
private readonly manageFeeService: ManageFeeService,
|
|
private readonly homePageDataService: HomePageDataService
|
|
) { }
|
|
|
|
// HomePageData
|
|
@ApiTags('HomePage - Oracle')
|
|
@Get('/GetHomePageData/:id')
|
|
GetHomePageData(@Param('id', ParseIntPipe) id: number) {
|
|
return this.homePageDataService.GetHomePageData(id);
|
|
}
|
|
|
|
@ApiTags('HomePage - Oracle')
|
|
@Get('/GetCarnetSummaryData/:userid')
|
|
GetCarnetSummaryData(@Param('userid') id: string) {
|
|
return this.homePageDataService.GetCarnetSummaryData(id);
|
|
}
|
|
|
|
@ApiTags('HomePage - Oracle')
|
|
@Post('/SaveCarnetApplication')
|
|
SaveCarnetApplication(@Body() body: SaveCarnetApplicationDTO) {
|
|
return this.homePageDataService.SaveCarnetApplication(body);
|
|
// return body;
|
|
}
|
|
|
|
@ApiTags('HomePage - Oracle')
|
|
@Post('/TransmitApplicationtoProcess')
|
|
TransmitApplicationtoProcess(@Body() body: TransmitApplicationtoProcessDTO) {
|
|
return this.homePageDataService.TransmitApplicationtoProcess(body);
|
|
}
|
|
|
|
@ApiTags('HomePage - Oracle')
|
|
@Get('/GetCarnetDetailsbyCarnetStatus/:p_spid/:p_userid/:p_CarnetStatus')
|
|
GetCarnetDetailsbyCarnetStatus(
|
|
@Param('p_spid', ParseIntPipe) p_spid: number,
|
|
@Param('p_userid') p_userid: string,
|
|
@Param('p_CarnetStatus') p_CarnetStatus: string
|
|
) {
|
|
if (!p_spid || !p_userid || !p_CarnetStatus) {
|
|
throw new BadRequestException('spid, userid and Carnet Status are required');
|
|
}
|
|
else if (Number(p_userid) || Number(p_CarnetStatus )) {
|
|
throw new BadRequestException('Param p_userid and p_CarnetStatus should be string');
|
|
}
|
|
try {
|
|
const body: GetCarnetDetailsbyCarnetStatusDTO = {
|
|
p_spid: p_spid,
|
|
p_userid: p_userid,
|
|
p_CarnetStatus: p_CarnetStatus
|
|
};
|
|
|
|
return this.homePageDataService.GetCarnetDetailsbyCarnetStatus(body);
|
|
}
|
|
catch (err) {
|
|
return new BadRequestException({ message: 'Validation faileda', error: err.message })
|
|
}
|
|
}
|
|
|
|
// @ApiTags('HomePage - Oracle')
|
|
// @Post('/test')
|
|
// test(@Body() body:TestDTO) {
|
|
|
|
// return body;
|
|
// }
|
|
|
|
// 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,
|
|
body.P_NOTES,
|
|
body.P_FILEIDS
|
|
)
|
|
}
|
|
|
|
@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,
|
|
body.P_NOTES,
|
|
body.P_FILEIDS
|
|
)
|
|
}
|
|
|
|
@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_MIDDLEINITIAL,
|
|
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_MIDDLEINITIAL,
|
|
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: UpdateFeeCommBodyDTO) {
|
|
return this.manageFeeService.UPDATEFEECOMM(body)
|
|
}
|
|
|
|
@ApiTags('Manage Fee - Oracle')
|
|
@Get('/GetBasicFeeRates/:P_SPID/:P_ACTIVE_INACTIVE')
|
|
GetBasicFeeRates(
|
|
@Param('P_SPID', ParseIntPipe) P_SPID: number,
|
|
@Param('P_ACTIVE_INACTIVE',) P_ACTIVE_INACTIVE: string
|
|
) {
|
|
return this.manageFeeService.GETBASICFEERATES(P_SPID, P_ACTIVE_INACTIVE)
|
|
}
|
|
|
|
@ApiTags('Manage Fee - Oracle')
|
|
@Get('/GetBondRates/:P_SPID/:P_ACTIVE_INACTIVE')
|
|
GetBondRates(
|
|
@Param('P_SPID', ParseIntPipe) P_SPID: number,
|
|
@Param('P_ACTIVE_INACTIVE',) P_ACTIVE_INACTIVE: string
|
|
) {
|
|
return this.manageFeeService.GETBONDRATES(P_SPID, P_ACTIVE_INACTIVE)
|
|
}
|
|
|
|
@ApiTags('Manage Fee - Oracle')
|
|
@Get('/GetCargoRates/:P_SPID/:P_ACTIVE_INACTIVE')
|
|
GetCargoRates(
|
|
@Param('P_SPID', ParseIntPipe) P_SPID: number,
|
|
@Param('P_ACTIVE_INACTIVE',) P_ACTIVE_INACTIVE: string
|
|
) {
|
|
return this.manageFeeService.GETCARGORATES(P_SPID, P_ACTIVE_INACTIVE)
|
|
}
|
|
|
|
@ApiTags('Manage Fee - Oracle')
|
|
@Get('/GetCfFeeRates/:P_SPID/:P_ACTIVE_INACTIVE')
|
|
GetCfFeeRates(
|
|
@Param('P_SPID', ParseIntPipe) P_SPID: number,
|
|
@Param('P_ACTIVE_INACTIVE',) P_ACTIVE_INACTIVE: string
|
|
) {
|
|
return this.manageFeeService.GETCFFEERATES(P_SPID, P_ACTIVE_INACTIVE)
|
|
}
|
|
|
|
@ApiTags('Manage Fee - Oracle')
|
|
@Get('/GetCsFeeRates/:P_SPID/:P_ACTIVE_INACTIVE')
|
|
GetCsFeeRates(
|
|
@Param('P_SPID', ParseIntPipe) P_SPID: number,
|
|
@Param('P_ACTIVE_INACTIVE',) P_ACTIVE_INACTIVE: string
|
|
) {
|
|
return this.manageFeeService.GETCSFEERATES(P_SPID, P_ACTIVE_INACTIVE)
|
|
}
|
|
|
|
@ApiTags('Manage Fee - Oracle')
|
|
@Get('/GetEfFeeRates/:P_SPID/:P_ACTIVE_INACTIVE')
|
|
GetEfFeeRates(
|
|
@Param('P_SPID', ParseIntPipe) P_SPID: number,
|
|
@Param('P_ACTIVE_INACTIVE',) P_ACTIVE_INACTIVE: string
|
|
) {
|
|
return this.manageFeeService.GETEFFEERATES(P_SPID, P_ACTIVE_INACTIVE)
|
|
}
|
|
|
|
@ApiTags('Manage Fee - Oracle')
|
|
@Get('/GetFeeComm/:P_SPID/:P_ACTIVE_INACTIVE')
|
|
GetFeeComm(
|
|
@Param('P_SPID', ParseIntPipe) P_SPID: number,
|
|
@Param('P_ACTIVE_INACTIVE') P_ACTIVE_INACTIVE: string
|
|
) {
|
|
return this.manageFeeService.GETFEECOMM(P_SPID, P_ACTIVE_INACTIVE)
|
|
}
|
|
|
|
}
|