added Estimated fees and changed access for requested endpoint, made searchHolder API Holdername Optional
This commit is contained in:
parent
d90c79fd67
commit
f4dd591198
2
api.http
2
api.http
@ -2,7 +2,7 @@ GET http://192.168.1.96:3006
|
|||||||
|
|
||||||
###
|
###
|
||||||
|
|
||||||
GET http://localhost:3006
|
GET http://localhost:3000/oracle/SearchHolder/1
|
||||||
|
|
||||||
###
|
###
|
||||||
|
|
||||||
|
|||||||
@ -96,5 +96,5 @@ export class HolderContactActivateOrInactivateDTO extends IntersectionType(
|
|||||||
|
|
||||||
export class SearchHolderDTO extends IntersectionType(
|
export class SearchHolderDTO extends IntersectionType(
|
||||||
SPID_DTO,
|
SPID_DTO,
|
||||||
HOLDERNAME_DTO
|
PartialType(HOLDERNAME_DTO)
|
||||||
) { }
|
) { }
|
||||||
@ -78,6 +78,11 @@ export class CarnetApplicationController {
|
|||||||
return this.carnetApplicationService.UpdateShippingDetails(body);
|
return this.carnetApplicationService.UpdateShippingDetails(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Get('EstimatedFees/:P_SPID/:P_USERID/:P_HEADERID')
|
||||||
|
EstimatedFees(@Param() body: GetCarnetControlCenterDTO) {
|
||||||
|
return this.carnetApplicationService.EstimatedFees(body);
|
||||||
|
}
|
||||||
|
|
||||||
// processing [ PROCESSINGCENTER_PKG ]
|
// processing [ PROCESSINGCENTER_PKG ]
|
||||||
|
|
||||||
@Patch('ProcessOriginalCarnet')
|
@Patch('ProcessOriginalCarnet')
|
||||||
|
|||||||
@ -688,6 +688,41 @@ export class CarnetApplicationService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async EstimatedFees(body: GetCarnetControlCenterDTO) {
|
||||||
|
let connection;
|
||||||
|
|
||||||
|
try {
|
||||||
|
connection = await this.oracleDBService.getConnection();
|
||||||
|
|
||||||
|
const result = await connection.execute(
|
||||||
|
`BEGIN
|
||||||
|
CARNETAPPLICATION_PKG.EstimatedFees(
|
||||||
|
:P_SPID, :P_USERID , :P_HEADERID, :P_CURSOR
|
||||||
|
);
|
||||||
|
END;`,
|
||||||
|
{
|
||||||
|
P_SPID: { val: body.P_SPID, type: oracledb.DB_TYPE_NUMBER },
|
||||||
|
P_USERID: { val: body.P_USERID, type: oracledb.DB_TYPE_NVARCHAR },
|
||||||
|
P_HEADERID: { val: body.P_HEADERID, type: oracledb.DB_TYPE_NUMBER },
|
||||||
|
P_CURSOR: { type: oracledb.CURSOR, dir: oracledb.BIND_OUT }
|
||||||
|
},
|
||||||
|
{ outFormat: oracledb.OUT_FORMAT_OBJECT }
|
||||||
|
);
|
||||||
|
|
||||||
|
const outBinds = result.outBinds;
|
||||||
|
if (!outBinds?.P_CURSOR) {
|
||||||
|
this.logger.error('One or more expected cursors are missing from stored procedure output.');
|
||||||
|
throw new InternalServerException("Incomplete data received from the database.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return await fetchCursor(outBinds.P_CURSOR, CarnetApplicationService.name);
|
||||||
|
} catch (error) {
|
||||||
|
handleError(error, CarnetApplicationService.name)
|
||||||
|
} finally {
|
||||||
|
await closeOracleDbConnection(connection, CarnetApplicationService.name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// processing [ PROCESSINGCENTER_PKG ]
|
// processing [ PROCESSINGCENTER_PKG ]
|
||||||
|
|
||||||
async ProcessOriginalCarnet(body: CarnetProcessingCenterDTO) {
|
async ProcessOriginalCarnet(body: CarnetProcessingCenterDTO) {
|
||||||
|
|||||||
@ -33,16 +33,19 @@ export class ManageClientsController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Put('UpdateClientContacts')
|
@Put('UpdateClientContacts')
|
||||||
|
@Roles('ca','sa')
|
||||||
UpdateClientContacts(@Body() body: UpdateClientContactsDTO) {
|
UpdateClientContacts(@Body() body: UpdateClientContactsDTO) {
|
||||||
return this.manageClientsService.UpdateClientContacts(body);
|
return this.manageClientsService.UpdateClientContacts(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Put('UpdateClientLocations')
|
@Put('UpdateClientLocations')
|
||||||
|
@Roles('ca','sa')
|
||||||
UpdateClientLocations(@Body() body: UpdateClientLocationsDTO) {
|
UpdateClientLocations(@Body() body: UpdateClientLocationsDTO) {
|
||||||
return this.manageClientsService.UpdateClientLocations(body);
|
return this.manageClientsService.UpdateClientLocations(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Post('CreateClientContacts')
|
@Post('CreateClientContacts')
|
||||||
|
@Roles('ca','sa')
|
||||||
CreateClientContact(@Body() body: CreateClientContactsDTO) {
|
CreateClientContact(@Body() body: CreateClientContactsDTO) {
|
||||||
return this.manageClientsService.CreateClientContact(body);
|
return this.manageClientsService.CreateClientContact(body);
|
||||||
}
|
}
|
||||||
@ -63,6 +66,7 @@ export class ManageClientsController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Post('CreateClientLocations')
|
@Post('CreateClientLocations')
|
||||||
|
@Roles('ca','sa')
|
||||||
CreateClientLocation(@Body() body: CreateClientLocationsDTO) {
|
CreateClientLocation(@Body() body: CreateClientLocationsDTO) {
|
||||||
return this.manageClientsService.CreateClientLocation(body);
|
return this.manageClientsService.CreateClientLocation(body);
|
||||||
}
|
}
|
||||||
@ -78,16 +82,19 @@ export class ManageClientsController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Get('GetPreparerContactsByClientid/:P_SPID/:P_CLIENTID')
|
@Get('GetPreparerContactsByClientid/:P_SPID/:P_CLIENTID')
|
||||||
|
@Roles('ca','sa')
|
||||||
GetPreparerContactsByClientid(@Param() body: GetClientDTO) {
|
GetPreparerContactsByClientid(@Param() body: GetClientDTO) {
|
||||||
return this.manageClientsService.GetPreparerContactsByClientid(body);
|
return this.manageClientsService.GetPreparerContactsByClientid(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get('GetPreparerContactsbyClientLocationID/:P_SPID/:P_LOCATIONID')
|
@Get('GetPreparerContactsbyClientLocationID/:P_SPID/:P_LOCATIONID')
|
||||||
|
@Roles('ca','sa')
|
||||||
GetPreparerContactsbyClientLocationID(@Param() body: GetClientContactByLacationIdDTO) {
|
GetPreparerContactsbyClientLocationID(@Param() body: GetClientContactByLacationIdDTO) {
|
||||||
return this.manageClientsService.GetPreparerContactsbyClientLocationID(body);
|
return this.manageClientsService.GetPreparerContactsbyClientLocationID(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Get('GetPreparerLocByClientid/:P_SPID/:P_CLIENTID')
|
@Get('GetPreparerLocByClientid/:P_SPID/:P_CLIENTID')
|
||||||
|
@Roles('ca','sa')
|
||||||
GetPreparerLocByClientid(@Param() body: GetClientDTO) {
|
GetPreparerLocByClientid(@Param() body: GetClientDTO) {
|
||||||
return this.manageClientsService.GetPreparerLocByClientid(body);
|
return this.manageClientsService.GetPreparerLocByClientid(body);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,15 +8,16 @@ import {
|
|||||||
Patch,
|
Patch,
|
||||||
Post,
|
Post,
|
||||||
Put,
|
Put,
|
||||||
|
Query,
|
||||||
UseGuards,
|
UseGuards,
|
||||||
} from '@nestjs/common';
|
} from '@nestjs/common';
|
||||||
import { ApiTags } from '@nestjs/swagger';
|
import { ApiQuery, ApiTags } from '@nestjs/swagger';
|
||||||
import { ManageHoldersService } from './manage-holders.service';
|
import { ManageHoldersService } from './manage-holders.service';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
CreateHolderContactsDTO,
|
CreateHolderContactsDTO,
|
||||||
CreateHoldersDTO, GetHolderDTO, HolderActivateOrInactivateDTO,
|
CreateHoldersDTO, GetHolderDTO, HolderActivateOrInactivateDTO,
|
||||||
HolderContactActivateOrInactivateDTO, SearchHolderDTO, UpdateHolderContactDTO, UpdateHolderDTO
|
HolderContactActivateOrInactivateDTO, SearchHolderDTO, SPID_DTO, UpdateHolderContactDTO, UpdateHolderDTO
|
||||||
} from 'src/dto/property.dto';
|
} from 'src/dto/property.dto';
|
||||||
import { Roles } from 'src/decorators/roles.decorator';
|
import { Roles } from 'src/decorators/roles.decorator';
|
||||||
import { JwtAuthGuard } from 'src/guards/jwt-auth.guard';
|
import { JwtAuthGuard } from 'src/guards/jwt-auth.guard';
|
||||||
@ -29,16 +30,39 @@ import { RolesGuard } from 'src/guards/roles.guard';
|
|||||||
export class ManageHoldersController {
|
export class ManageHoldersController {
|
||||||
constructor(private readonly manageHoldersService: ManageHoldersService) { }
|
constructor(private readonly manageHoldersService: ManageHoldersService) { }
|
||||||
|
|
||||||
@Get('SearchHolder/:P_SPID/:P_HOLDERNAME')
|
@Get('SearchHolder/:P_SPID')
|
||||||
SearchHolder(@Param() param: SearchHolderDTO) {
|
@ApiQuery({ name: "P_HOLDERNAME", type: String, required: false, description: "Optional" })
|
||||||
return this.manageHoldersService.SearchHolder(param)
|
SearchHolder(
|
||||||
|
@Param('P_SPID') P_SPID: number,
|
||||||
|
@Query('P_HOLDERNAME') P_HOLDERNAME?: string | null | undefined,
|
||||||
|
) {
|
||||||
|
let rawHolderName: string | null | undefined = P_HOLDERNAME;
|
||||||
|
|
||||||
|
if (typeof rawHolderName === 'string') {
|
||||||
|
rawHolderName = rawHolderName.trim();
|
||||||
|
rawHolderName = rawHolderName.replace(/^['"]|['"]$/g, '');
|
||||||
|
|
||||||
|
if (rawHolderName === '' || rawHolderName.toLowerCase() === 'null') {
|
||||||
|
rawHolderName = null;
|
||||||
|
} else {
|
||||||
|
const allowedPattern = /^[A-Za-z0-9 _@&.-]+$/;
|
||||||
|
|
||||||
|
// uncomment for strict validation
|
||||||
|
|
||||||
|
// if (!allowedPattern.test(rawHolderName)) {
|
||||||
|
// rawHolderName = null;
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
rawHolderName = null;
|
||||||
|
}
|
||||||
|
const body = { P_SPID, P_HOLDERNAME: rawHolderName }
|
||||||
|
return this.manageHoldersService.SearchHolder(body)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Post('/CreateHolderData')
|
@Post('/CreateHolderData')
|
||||||
CreateHolders(@Body() body: CreateHoldersDTO) {
|
CreateHolders(@Body() body: CreateHoldersDTO) {
|
||||||
return this.manageHoldersService.CreateHolders(body);
|
return this.manageHoldersService.CreateHolders(body);
|
||||||
// return this.manageHoldersService.CreateHoldersX();
|
|
||||||
// return {message:"Request received.."}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Post('CreateHoldercontact')
|
@Post('CreateHoldercontact')
|
||||||
|
|||||||
@ -8,7 +8,7 @@ import { closeOracleDbConnection, fetchCursor, handleError, setEmptyStringsToNul
|
|||||||
import {
|
import {
|
||||||
CreateHolderContactsDTO,
|
CreateHolderContactsDTO,
|
||||||
CreateHoldersDTO, GetHolderDTO, HolderActivateOrInactivateDTO,
|
CreateHoldersDTO, GetHolderDTO, HolderActivateOrInactivateDTO,
|
||||||
HolderContactActivateOrInactivateDTO, SearchHolderDTO, UpdateHolderContactDTO, UpdateHolderDTO
|
HolderContactActivateOrInactivateDTO, SearchHolderDTO, SPID_DTO, UpdateHolderContactDTO, UpdateHolderDTO
|
||||||
} from 'src/dto/property.dto';
|
} from 'src/dto/property.dto';
|
||||||
import { OracleService } from '../oracle.service';
|
import { OracleService } from '../oracle.service';
|
||||||
import { BadRequestException } from 'src/exceptions/badRequest.exception';
|
import { BadRequestException } from 'src/exceptions/badRequest.exception';
|
||||||
@ -631,7 +631,7 @@ export class ManageHoldersService {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
SearchHolder = async (body: SearchHolderDTO) => {
|
SearchHolder = async (body: { P_SPID: number, P_HOLDERNAME: string | null }) => {
|
||||||
let connection;
|
let connection;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user