response aligned to match same as oracle
This commit is contained in:
parent
cecfa1030a
commit
7ea099d611
@ -6,7 +6,7 @@ import {
|
||||
AddGenerallistItemsDTO,
|
||||
CA_UpdateHolderDTO,
|
||||
CapturePaymentDTO,
|
||||
CarnetProcessingCenterDTO, CarnetProcessingCenterDTO2, CopyCarnetDTO, CreateApplicationDTO, DeleteGenerallistItemsDTO, EditGenerallistItemsDTO, GetCarnetControlCenterDTO, GetExtendedSectionDTO, GetOrderDetailsDTO, GetPaymentHistoryDTO, InitiatePaymentDTO, PrintCarnetDTO, PrintGLDTO, SaveCarnetApplicationDTO, SaveExtensionApplicationDTO, SaveHistoryDTO, TransmitApplicationtoProcessDTO,
|
||||
CarnetProcessingCenterDTO, CarnetProcessingCenterDTO2, CopyCarnetDTO, CreateApplicationDTO, DeleteGenerallistItemsDTO, EditGenerallistItemsDTO, GetCarnetControlCenterDTO, GetCarnetDetailsbyCarnetStatusDTO, GetExtendedSectionDTO, GetOrderDetailsDTO, GetPaymentHistoryDTO, InitiatePaymentDTO, PrintCarnetDTO, PrintGLDTO, SaveCarnetApplicationDTO, SaveExtensionApplicationDTO, SaveHistoryDTO, TransmitApplicationtoProcessDTO,
|
||||
UpdateExpGoodsAuthRepDTO,
|
||||
UpdateShippingDetailsDTO
|
||||
} from 'src/dto/property.dto';
|
||||
@ -31,6 +31,7 @@ export class CarnetApplicationController {
|
||||
|
||||
// [ CARNETAPPLICATION_PKG ]
|
||||
|
||||
// not used
|
||||
// @Post('SaveCarnetApplication')
|
||||
// async CreateClientData(@Body() body: SaveCarnetApplicationDTO) {
|
||||
// return this.carnetApplicationService.SaveCarnetApplication(body);
|
||||
@ -63,11 +64,6 @@ export class CarnetApplicationController {
|
||||
return this.carnetApplicationService.AddGenerallistItems(body);
|
||||
}
|
||||
|
||||
@Post('AddCountries')
|
||||
AddCountries(@Body() body: AddCountriesDTO) {
|
||||
return this.carnetApplicationService.AddCountries(body);
|
||||
}
|
||||
|
||||
@Put('EditGenerallistItems')
|
||||
EditGenerallistItems(@Body() body: EditGenerallistItemsDTO) {
|
||||
return this.carnetApplicationService.EditGenerallistItems(body);
|
||||
@ -78,6 +74,11 @@ export class CarnetApplicationController {
|
||||
return this.carnetApplicationService.DeleteGenerallistItems(body);
|
||||
}
|
||||
|
||||
@Post('AddCountries')
|
||||
AddCountries(@Body() body: AddCountriesDTO) {
|
||||
return this.carnetApplicationService.AddCountries(body);
|
||||
}
|
||||
|
||||
@Patch('UpdateShippingDetails')
|
||||
UpdateShippingDetails(@Body() body: UpdateShippingDetailsDTO) {
|
||||
return this.carnetApplicationService.UpdateShippingDetails(body);
|
||||
@ -91,7 +92,7 @@ export class CarnetApplicationController {
|
||||
// // processing [ PROCESSINGCENTER_PKG ]
|
||||
|
||||
@Patch('ProcessCarnet')
|
||||
ProcessOriginalCarnet(@Body() body: CarnetProcessingCenterDTO) {
|
||||
ProcessCarnet(@Body() body: CarnetProcessingCenterDTO) {
|
||||
return this.carnetApplicationService.ProcessCarnet(body);
|
||||
}
|
||||
|
||||
@ -106,7 +107,6 @@ export class CarnetApplicationController {
|
||||
return this.carnetApplicationService.VoidCarnet(body);
|
||||
}
|
||||
|
||||
|
||||
@Patch('CopyCarnet')
|
||||
CopyCarnet(@Body() body: CopyCarnetDTO) {
|
||||
return this.carnetApplicationService.CopyCarnet(body);
|
||||
@ -182,6 +182,12 @@ export class CarnetApplicationController {
|
||||
return this.carnetApplicationService.GetShipPaymentDetailstoEdit(body);
|
||||
}
|
||||
|
||||
@Get('GetCarnetDetailsbyCarnetStatus/:P_SPID/:P_USERID/:P_CARNETSTATUS')
|
||||
@Roles('pca', 'psa', 'pua')
|
||||
GetCarnetDetailsbyCarnetStatus(@Param() params: GetCarnetDetailsbyCarnetStatusDTO) {
|
||||
return this.carnetApplicationService.GetCarnetDetailsbyCarnetStatus(params);
|
||||
}
|
||||
|
||||
// [PRINT_PKG]
|
||||
@Post('PrintCarnet')
|
||||
@HttpCode(200)
|
||||
|
||||
@ -21,7 +21,8 @@ import {
|
||||
InitiatePaymentDTO,
|
||||
GetOrderDetailsDTO,
|
||||
GetPaymentHistoryDTO,
|
||||
SaveHistoryDTO
|
||||
SaveHistoryDTO,
|
||||
GetCarnetDetailsbyCarnetStatusDTO
|
||||
} from 'src/dto/property.dto';
|
||||
import { BadRequestException } from 'src/exceptions/badRequest.exception';
|
||||
import { PoolClient } from 'pg';
|
||||
@ -516,7 +517,7 @@ export class CarnetApplicationService {
|
||||
await client.query(`CLOSE ${cursorName}`);
|
||||
await client.query('COMMIT');
|
||||
|
||||
return toUpperCaseKeys(fetchResult.rows);
|
||||
return toUpperCaseKeys(fetchResult.rows)[0] ?? [];
|
||||
|
||||
} catch (error) {
|
||||
if (client) await client.query('ROLLBACK');
|
||||
@ -1000,7 +1001,7 @@ export class CarnetApplicationService {
|
||||
await client.query(`CLOSE ${cursorName}`);
|
||||
await client.query('COMMIT');
|
||||
|
||||
return toUpperCaseKeys(fetchResult.rows);
|
||||
return toUpperCaseKeys(fetchResult.rows)[0] ?? [];
|
||||
|
||||
} catch (error) {
|
||||
if (client) await client.query('ROLLBACK');
|
||||
@ -1032,7 +1033,39 @@ export class CarnetApplicationService {
|
||||
await client.query(`CLOSE ${cursorName}`);
|
||||
await client.query('COMMIT');
|
||||
|
||||
return toUpperCaseKeys(fetchResult.rows);
|
||||
return toUpperCaseKeys(fetchResult.rows)[0] ?? [];
|
||||
|
||||
} catch (error) {
|
||||
if (client) await client.query('ROLLBACK');
|
||||
handlePgError(error, CarnetApplicationService.name)
|
||||
} finally {
|
||||
releasePgClient(client)
|
||||
}
|
||||
}
|
||||
|
||||
async GetGoodsItemstoEdit(body: GetCarnetControlCenterDTO) {
|
||||
let client: PoolClient | null = null;
|
||||
|
||||
const cursorName = 'p_cursor';
|
||||
|
||||
try {
|
||||
client = await this.pgDBService.getConnection();
|
||||
|
||||
await client.query('BEGIN');
|
||||
|
||||
const callProcQuery = `
|
||||
CALL "CARNETSYS".carnetcontrolcenter_pkg_getgoodsitemstoedit($1, $2, $3, $4)
|
||||
`;
|
||||
await client.query(callProcQuery, [body.P_SPID, body.P_USERID, body.P_HEADERID, cursorName]);
|
||||
|
||||
// 🚫 DON'T quote the cursor name in FETCH
|
||||
const fetchResult = await client.query(`FETCH ALL FROM ${cursorName}`);
|
||||
|
||||
// 🚫 DON'T quote the cursor name in CLOSE
|
||||
await client.query(`CLOSE ${cursorName}`);
|
||||
await client.query('COMMIT');
|
||||
|
||||
return toUpperCaseKeys(fetchResult.rows)[0] ?? [];
|
||||
|
||||
} catch (error) {
|
||||
if (client) await client.query('ROLLBACK');
|
||||
@ -1064,7 +1097,7 @@ export class CarnetApplicationService {
|
||||
await client.query(`CLOSE ${cursorName}`);
|
||||
await client.query('COMMIT');
|
||||
|
||||
return toUpperCaseKeys(fetchResult.rows);
|
||||
return toUpperCaseKeys(fetchResult.rows)[0] ?? [];
|
||||
|
||||
} catch (error) {
|
||||
if (client) await client.query('ROLLBACK');
|
||||
@ -1096,7 +1129,7 @@ export class CarnetApplicationService {
|
||||
await client.query(`CLOSE ${cursorName}`);
|
||||
await client.query('COMMIT');
|
||||
|
||||
return toUpperCaseKeys(fetchResult.rows);
|
||||
return toUpperCaseKeys(fetchResult.rows)[0] ?? [];
|
||||
|
||||
} catch (error) {
|
||||
if (client) await client.query('ROLLBACK');
|
||||
@ -1106,7 +1139,8 @@ export class CarnetApplicationService {
|
||||
}
|
||||
}
|
||||
|
||||
async GetGoodsItemstoEdit(body: GetCarnetControlCenterDTO) {
|
||||
async GetCarnetDetailsbyCarnetStatus(body: GetCarnetDetailsbyCarnetStatusDTO) {
|
||||
|
||||
let client: PoolClient | null = null;
|
||||
|
||||
const cursorName = 'p_cursor';
|
||||
@ -1117,9 +1151,9 @@ export class CarnetApplicationService {
|
||||
await client.query('BEGIN');
|
||||
|
||||
const callProcQuery = `
|
||||
CALL "CARNETSYS".carnetcontrolcenter_pkg_getgoodsitemstoedit($1, $2, $3, $4)
|
||||
CALL "CARNETSYS".carnetcontrolcenter_pkg_getcarnetdetails($1, $2, $3, $4)
|
||||
`;
|
||||
await client.query(callProcQuery, [body.P_SPID, body.P_USERID, body.P_HEADERID, cursorName]);
|
||||
await client.query(callProcQuery, [body.P_SPID, body.P_USERID, body.P_CARNETSTATUS, cursorName]);
|
||||
|
||||
// 🚫 DON'T quote the cursor name in FETCH
|
||||
const fetchResult = await client.query(`FETCH ALL FROM ${cursorName}`);
|
||||
@ -1128,6 +1162,8 @@ export class CarnetApplicationService {
|
||||
await client.query(`CLOSE ${cursorName}`);
|
||||
await client.query('COMMIT');
|
||||
|
||||
checkPgUserDefinedErrors(fetchResult);
|
||||
|
||||
return toUpperCaseKeys(fetchResult.rows);
|
||||
|
||||
} catch (error) {
|
||||
@ -1664,7 +1700,7 @@ export class CarnetApplicationService {
|
||||
await client.query(`CLOSE ${cursorName}`);
|
||||
await client.query('COMMIT');
|
||||
|
||||
return toUpperCaseKeys(fetchResult.rows);
|
||||
return toUpperCaseKeys(fetchResult.rows)[0] ?? [];
|
||||
|
||||
} catch (error) {
|
||||
if (client) await client.query('ROLLBACK');
|
||||
|
||||
@ -103,7 +103,7 @@ export class ManageClientsService {
|
||||
checkPgUserDefinedErrors(fetchResult);
|
||||
|
||||
return {
|
||||
statusCode: 201,
|
||||
statusCode: 200,
|
||||
message: ResponseStatus.updated,
|
||||
...toUpperCaseKeys(fetchResult?.rows)[0]
|
||||
};
|
||||
@ -155,7 +155,7 @@ export class ManageClientsService {
|
||||
checkPgUserDefinedErrors(fetchResult);
|
||||
|
||||
return {
|
||||
statusCode: 201,
|
||||
statusCode: 200,
|
||||
message: ResponseStatus.updated,
|
||||
...toUpperCaseKeys(fetchResult?.rows)[0]
|
||||
};
|
||||
@ -206,7 +206,7 @@ export class ManageClientsService {
|
||||
checkPgUserDefinedErrors(fetchResult);
|
||||
|
||||
return {
|
||||
statusCode: 201,
|
||||
statusCode: 200,
|
||||
message: ResponseStatus.updated,
|
||||
...toUpperCaseKeys(fetchResult?.rows)[0]
|
||||
};
|
||||
@ -528,7 +528,7 @@ export class ManageClientsService {
|
||||
|
||||
checkPgUserDefinedErrors(fetchResult);
|
||||
|
||||
return toUpperCaseKeys(fetchResult.rows);
|
||||
return toUpperCaseKeys(fetchResult.rows)[0] ?? [];
|
||||
|
||||
} catch (error) {
|
||||
if (client) await client.query('ROLLBACK');
|
||||
|
||||
@ -15,125 +15,125 @@ export class ManageFeeController {
|
||||
constructor(private readonly manageFeeService: ManageFeeService) { }
|
||||
|
||||
@Get('/GetBasicFeeRates/:P_SPID/:P_ACTIVE_INACTIVE')
|
||||
GetBasicFeeRates(@Param() body: GetFeeGeneralDTO) {
|
||||
GETBASICFEERATES(@Param() body: GetFeeGeneralDTO) {
|
||||
return this.manageFeeService.GETBASICFEERATES(body);
|
||||
}
|
||||
|
||||
@Post('/CreateBasicFee')
|
||||
CreateBasicFee(@Body() body: CreateBasicFeeDTO) {
|
||||
CREATEBASICFEE(@Body() body: CreateBasicFeeDTO) {
|
||||
return this.manageFeeService.CREATEBASICFEE(body);
|
||||
}
|
||||
|
||||
@Patch('/UpdateBasicFee')
|
||||
UpdateBasicFee(@Body() body: UpdateBasicFeeDTO) {
|
||||
UPDATEBASICFEE(@Body() body: UpdateBasicFeeDTO) {
|
||||
return this.manageFeeService.UPDATEBASICFEE(body);
|
||||
}
|
||||
|
||||
// bond rate
|
||||
|
||||
@Get('/GetBondRates/:P_SPID/:P_ACTIVE_INACTIVE')
|
||||
GetBondRates(@Param() body: GetFeeGeneralDTO) {
|
||||
GETBONDRATES(@Param() body: GetFeeGeneralDTO) {
|
||||
return this.manageFeeService.GETBONDRATES(body);
|
||||
}
|
||||
|
||||
@Post('/CreateBondRate')
|
||||
CreateBondRate(@Body() body: CreateBondRateDTO) {
|
||||
CREATEBONDRATE(@Body() body: CreateBondRateDTO) {
|
||||
return this.manageFeeService.CREATEBONDRATE(body);
|
||||
}
|
||||
|
||||
|
||||
@Patch('/UpdateBondRate')
|
||||
UpdateBondRate(@Body() body: UpdateBondRateDTO) {
|
||||
UPDATEBONDRATE(@Body() body: UpdateBondRateDTO) {
|
||||
return this.manageFeeService.UPDATEBONDRATE(body);
|
||||
}
|
||||
|
||||
// cargo rate
|
||||
|
||||
@Get('/GetCargoRates/:P_SPID/:P_ACTIVE_INACTIVE')
|
||||
GetCargoRates(@Param() body: GetFeeGeneralDTO) {
|
||||
GETCARGORATES(@Param() body: GetFeeGeneralDTO) {
|
||||
return this.manageFeeService.GETCARGORATES(body);
|
||||
}
|
||||
|
||||
|
||||
@Post('/CreateCargoRate')
|
||||
CreateCargoRate(@Body() body: CreateCargoRateDTO) {
|
||||
CREATECARGORATE(@Body() body: CreateCargoRateDTO) {
|
||||
return this.manageFeeService.CREATECARGORATE(body);
|
||||
}
|
||||
|
||||
|
||||
@Patch('/UpdateCargoRate')
|
||||
UpdateCargoRate(@Body() body: UpdateCargoRateDTO) {
|
||||
UPDATECARGORATE(@Body() body: UpdateCargoRateDTO) {
|
||||
return this.manageFeeService.UPDATECARGORATE(body);
|
||||
}
|
||||
|
||||
// cf fee rate
|
||||
|
||||
@Get('/GetCfFeeRates/:P_SPID/:P_ACTIVE_INACTIVE')
|
||||
GetCfFeeRates(@Param() body: GetFeeGeneralDTO) {
|
||||
GETCFFEERATES(@Param() body: GetFeeGeneralDTO) {
|
||||
return this.manageFeeService.GETCFFEERATES(body);
|
||||
}
|
||||
|
||||
|
||||
@Post('/CreateCfFee')
|
||||
CreateCfFee(@Body() body: CreateCfFeeDTO) {
|
||||
CREATECFFEE(@Body() body: CreateCfFeeDTO) {
|
||||
return this.manageFeeService.CREATECFFEE(body);
|
||||
}
|
||||
|
||||
@Patch('/UpdateCfFee')
|
||||
UpdateCfFee(@Body() body: UpdateCfFeeDTO) {
|
||||
UPDATECFFEE(@Body() body: UpdateCfFeeDTO) {
|
||||
return this.manageFeeService.UPDATECFFEE(body);
|
||||
}
|
||||
|
||||
// cs fee rate
|
||||
|
||||
@Get('/GetCsFeeRates/:P_SPID/:P_ACTIVE_INACTIVE')
|
||||
GetCsFeeRates(@Param() body: GetFeeGeneralDTO) {
|
||||
GETCSFEERATES(@Param() body: GetFeeGeneralDTO) {
|
||||
return this.manageFeeService.GETCSFEERATES(body);
|
||||
}
|
||||
|
||||
@Post('/CreateCsFee')
|
||||
CreateCsFee(@Body() body: CreateCsFeeDTO) {
|
||||
CREATECSFEE(@Body() body: CreateCsFeeDTO) {
|
||||
return this.manageFeeService.CREATECSFEE(body);
|
||||
}
|
||||
|
||||
@Patch('/UpdateCsFee')
|
||||
UpdateCsFee(@Body() body: UpdateCsFeeDTO) {
|
||||
UPDATECSFEE(@Body() body: UpdateCsFeeDTO) {
|
||||
return this.manageFeeService.UPDATECSFEE(body);
|
||||
}
|
||||
|
||||
// ef fee rate
|
||||
|
||||
@Get('/GetEfFeeRates/:P_SPID/:P_ACTIVE_INACTIVE')
|
||||
GetEfFeeRates(@Param() body: GetFeeGeneralDTO) {
|
||||
GETEFFEERATES(@Param() body: GetFeeGeneralDTO) {
|
||||
return this.manageFeeService.GETEFFEERATES(body);
|
||||
}
|
||||
|
||||
@Post('/CreateEfFee')
|
||||
CreateEeFee(@Body() body: CreateEfFeeDTO) {
|
||||
CREATEEFFEE(@Body() body: CreateEfFeeDTO) {
|
||||
return this.manageFeeService.CREATEEFFEE(body);
|
||||
}
|
||||
|
||||
@Patch('/UpdateEfFee')
|
||||
UpdateEfFee(@Body() body: UpdateEfFeeDTO) {
|
||||
UPDATEEFFEE(@Body() body: UpdateEfFeeDTO) {
|
||||
return this.manageFeeService.UPDATEEFFEE(body);
|
||||
}
|
||||
|
||||
// fee comm
|
||||
|
||||
@Get('/GetFeeComm/:P_SPID/:P_ACTIVE_INACTIVE')
|
||||
GetFeeComm(@Param() body: GetFeeGeneralDTO) {
|
||||
GETFEECOMM(@Param() body: GetFeeGeneralDTO) {
|
||||
return this.manageFeeService.GETFEECOMM(body);
|
||||
}
|
||||
|
||||
|
||||
@Post('/CreateFeeComm')
|
||||
CreateFeeComm(@Body() body: CreateFeeCommDTO) {
|
||||
CREATEFEECOMM(@Body() body: CreateFeeCommDTO) {
|
||||
return this.manageFeeService.CREATEFEECOMM(body);
|
||||
}
|
||||
|
||||
|
||||
@Patch('/UpdateFeeComm')
|
||||
UpdateFeeComm(@Body() body: UpdateFeeCommDTO) {
|
||||
UPDATEFEECOMM(@Body() body: UpdateFeeCommDTO) {
|
||||
return this.manageFeeService.UPDATEFEECOMM(body);
|
||||
}
|
||||
}
|
||||
|
||||
@ -72,16 +72,16 @@ export class ManageHolderController {
|
||||
return this.manageHoldersService.UpdateHolder(body);
|
||||
}
|
||||
|
||||
@Get('/GetHolderRecord/:P_SPID/:P_HOLDERID')
|
||||
GetHolderRecord(@Param() body: GetHolderDTO) {
|
||||
return this.manageHoldersService.GetHolderRecord(body);
|
||||
}
|
||||
|
||||
@Put('/UpdateHolderContact')
|
||||
UpdateHolderContact(@Body() body: UpdateHolderContactDTO) {
|
||||
return this.manageHoldersService.UpdateHolderContact(body);
|
||||
}
|
||||
|
||||
@Get('/GetHolderRecord/:P_SPID/:P_HOLDERID')
|
||||
GetHolderMaster(@Param() body: GetHolderDTO) {
|
||||
return this.manageHoldersService.GetHolderRecord(body);
|
||||
}
|
||||
|
||||
@Get('/GetHolderContacts/:P_SPID/:P_HOLDERID')
|
||||
GetHolderContacts(@Param() body: GetHolderDTO) {
|
||||
return this.manageHoldersService.GetHolderContacts(body);
|
||||
|
||||
@ -9,6 +9,40 @@ export class ManageHolderService {
|
||||
|
||||
constructor(private readonly pgDBService: PgDBService) { }
|
||||
|
||||
SearchHolder = async (body: { P_SPID: number, P_USERID: string, P_HOLDERID: number | null, P_HOLDERNAME: string | null }) => {
|
||||
let client: PoolClient | null = null;
|
||||
|
||||
const cursorName = 'p_cursor';
|
||||
|
||||
try {
|
||||
client = await this.pgDBService.getConnection();
|
||||
|
||||
await client.query('BEGIN');
|
||||
|
||||
const callProcQuery = `
|
||||
CALL "CARNETSYS".manageholder_pkg_searchholder($1, $2, $3, $4, $5)
|
||||
`;
|
||||
await client.query(callProcQuery, [body.P_SPID, body.P_HOLDERID, body.P_HOLDERNAME, body.P_USERID, cursorName]);
|
||||
|
||||
// 🚫 DON'T quote the cursor name in FETCH
|
||||
const fetchResult = await client.query(`FETCH ALL FROM ${cursorName}`);
|
||||
|
||||
// 🚫 DON'T quote the cursor name in CLOSE
|
||||
await client.query(`CLOSE ${cursorName}`);
|
||||
await client.query('COMMIT');
|
||||
|
||||
checkPgUserDefinedErrors(fetchResult);
|
||||
|
||||
return toUpperCaseKeys(fetchResult.rows);
|
||||
|
||||
} catch (error) {
|
||||
if (client) await client.query('ROLLBACK');
|
||||
handlePgError(error, ManageHolderService.name)
|
||||
} finally {
|
||||
releasePgClient(client)
|
||||
}
|
||||
}
|
||||
|
||||
async CreateHolders(body: CreateHoldersDTO) {
|
||||
let client: PoolClient | null = null;
|
||||
|
||||
@ -177,7 +211,7 @@ export class ManageHolderService {
|
||||
checkPgUserDefinedErrors(fetchResult);
|
||||
|
||||
return {
|
||||
statusCode: 201,
|
||||
statusCode: 200,
|
||||
message: ResponseStatus.updated,
|
||||
...toUpperCaseKeys(fetchResult?.rows)[0]
|
||||
};
|
||||
@ -214,7 +248,7 @@ export class ManageHolderService {
|
||||
|
||||
checkPgUserDefinedErrors(fetchResult);
|
||||
|
||||
return toUpperCaseKeys(fetchResult.rows);
|
||||
return toUpperCaseKeys(fetchResult.rows)[0]??[];
|
||||
|
||||
} catch (error) {
|
||||
if (client) await client.query('ROLLBACK');
|
||||
@ -263,7 +297,7 @@ export class ManageHolderService {
|
||||
checkPgUserDefinedErrors(fetchResult);
|
||||
|
||||
return {
|
||||
statusCode: 201,
|
||||
statusCode: 200,
|
||||
message: ResponseStatus.updated,
|
||||
...toUpperCaseKeys(fetchResult?.rows)[0]
|
||||
};
|
||||
@ -462,37 +496,4 @@ export class ManageHolderService {
|
||||
}
|
||||
};
|
||||
|
||||
SearchHolder = async (body: { P_SPID: number, P_USERID: string, P_HOLDERID: number | null, P_HOLDERNAME: string | null }) => {
|
||||
let client: PoolClient | null = null;
|
||||
|
||||
const cursorName = 'p_cursor';
|
||||
|
||||
try {
|
||||
client = await this.pgDBService.getConnection();
|
||||
|
||||
await client.query('BEGIN');
|
||||
|
||||
const callProcQuery = `
|
||||
CALL "CARNETSYS".manageholder_pkg_searchholder($1, $2, $3, $4, $5)
|
||||
`;
|
||||
await client.query(callProcQuery, [body.P_SPID, body.P_HOLDERID, body.P_HOLDERNAME, body.P_USERID, cursorName]);
|
||||
|
||||
// 🚫 DON'T quote the cursor name in FETCH
|
||||
const fetchResult = await client.query(`FETCH ALL FROM ${cursorName}`);
|
||||
|
||||
// 🚫 DON'T quote the cursor name in CLOSE
|
||||
await client.query(`CLOSE ${cursorName}`);
|
||||
await client.query('COMMIT');
|
||||
|
||||
checkPgUserDefinedErrors(fetchResult);
|
||||
|
||||
return toUpperCaseKeys(fetchResult.rows);
|
||||
|
||||
} catch (error) {
|
||||
if (client) await client.query('ROLLBACK');
|
||||
handlePgError(error, ManageHolderService.name)
|
||||
} finally {
|
||||
releasePgClient(client)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -32,7 +32,7 @@ export class ParamTableController {
|
||||
type: String,
|
||||
description: 'The type of the parameter',
|
||||
})
|
||||
getParamValues(@Query() body: getParamValuesDTO) {
|
||||
GETPARAMVALUES(@Query() body: getParamValuesDTO) {
|
||||
return this.paramTableService.GETPARAMVALUES(body);
|
||||
}
|
||||
|
||||
@ -49,7 +49,7 @@ export class ParamTableController {
|
||||
type: String,
|
||||
description: 'The type of the parameter',
|
||||
})
|
||||
getAllParamValues(@Query() body: getParamValuesDTO) {
|
||||
GETALLPARAMVALUES(@Query() body: getParamValuesDTO) {
|
||||
return this.paramTableService.GETALLPARAMVALUES(body);
|
||||
}
|
||||
|
||||
@ -60,27 +60,27 @@ export class ParamTableController {
|
||||
}
|
||||
|
||||
@Post('/CreateTableRecord')
|
||||
createTableRecord(@Body() body: CreateTableRecordDTO) {
|
||||
CREATETABLERECORD(@Body() body: CreateTableRecordDTO) {
|
||||
return this.paramTableService.CREATETABLERECORD(body);
|
||||
}
|
||||
|
||||
@Post('/CreateParamRecord')
|
||||
createParamRecord(@Body() body: CreateParamRecordDTO) {
|
||||
CREATEPARAMRECORD(@Body() body: CreateParamRecordDTO) {
|
||||
return this.paramTableService.CREATEPARAMRECORD(body);
|
||||
}
|
||||
|
||||
@Patch('/UpdateParamRecord')
|
||||
UpdateParamRecord(@Body() body: UpdateParamRecordDTO) {
|
||||
UPDATEPARAMRECORD(@Body() body: UpdateParamRecordDTO) {
|
||||
return this.paramTableService.UPDATEPARAMRECORD(body);
|
||||
}
|
||||
|
||||
@Patch('/InActivateParamRecord')
|
||||
inActivateParamRecord(@Body() body: ActivateOrInactivateParamRecordDTO) {
|
||||
INACTIVATEPARAMRECORD(@Body() body: ActivateOrInactivateParamRecordDTO) {
|
||||
return this.paramTableService.INACTIVATEPARAMRECORD(body);
|
||||
}
|
||||
|
||||
@Patch('/ReActivateParamRecord')
|
||||
reActivateParamRecord(@Body() body: ActivateOrInactivateParamRecordDTO) {
|
||||
REACTIVATEPARAMRECORD(@Body() body: ActivateOrInactivateParamRecordDTO) {
|
||||
return this.paramTableService.REACTIVATEPARAMRECORD(body);
|
||||
}
|
||||
}
|
||||
|
||||
@ -37,7 +37,7 @@ export class SpContactsController {
|
||||
}
|
||||
|
||||
@Get('/GetSPDefaultContact/:P_SPID')
|
||||
getSPDefaultcontact(@Param() param: SPID_DTO) {
|
||||
getSPDefaultcontacts(@Param() param: SPID_DTO) {
|
||||
return this.spContactsService.getSPDefaultcontacts(param);
|
||||
}
|
||||
|
||||
|
||||
@ -20,7 +20,7 @@ export class SpController {
|
||||
}
|
||||
|
||||
@Put('/UpdateServiceProvider')
|
||||
updateServiceProider(@Body() body: UpdateServiceProviderDTO) {
|
||||
updateServiceProvider(@Body() body: UpdateServiceProviderDTO) {
|
||||
return this.spService.updateServiceProvider(body);
|
||||
}
|
||||
|
||||
@ -31,7 +31,7 @@ export class SpController {
|
||||
}
|
||||
|
||||
@Get('/GetSelectedServiceprovider/:P_SPID')
|
||||
getSelectedServiceprovider(@Param() param: SPID_DTO) {
|
||||
getServiceproviderByID(@Param() param: SPID_DTO) {
|
||||
return this.spService.getServiceproviderByID(param);
|
||||
}
|
||||
}
|
||||
|
||||
@ -125,7 +125,7 @@ export class SpService {
|
||||
|
||||
checkPgUserDefinedErrors(fetchResult);
|
||||
|
||||
return { statusCode: 201, message: ResponseStatus.created, ...toUpperCaseKeys(fetchResult?.rows)[0] || {} };
|
||||
return { statusCode: 200, message: ResponseStatus.updated, ...toUpperCaseKeys(fetchResult?.rows)[0] || {} };
|
||||
|
||||
} catch (error) {
|
||||
if (client) await client.query('ROLLBACK');
|
||||
@ -192,7 +192,7 @@ export class SpService {
|
||||
await client.query(`CLOSE ${cursorName}`);
|
||||
await client.query('COMMIT');
|
||||
|
||||
return toUpperCaseKeys(fetchResult.rows);
|
||||
return toUpperCaseKeys(fetchResult.rows)[0]??[];
|
||||
|
||||
} catch (error) {
|
||||
if (client) await client.query('ROLLBACK');
|
||||
|
||||
@ -63,13 +63,13 @@ export class UserMaintenanceController {
|
||||
@Get('GetClientloginsBySPID/:P_SPID')
|
||||
@Roles('psa')
|
||||
async GetClientloginsBySPID(@Param() params: SPID_DTO) {
|
||||
return await this.userMaintenanceService.GetSPLogins(params);
|
||||
return await this.userMaintenanceService.GetClientloginsBySPID(params);
|
||||
}
|
||||
|
||||
@Get('GetClientloginsByClientID/:P_SPID/:P_CLIENTID')
|
||||
@Roles('psa')
|
||||
async GetClientloginsByClientID(@Param() params: SPID_CLIENTID_DTO) {
|
||||
return await this.userMaintenanceService.GetSPLogins(params);
|
||||
return await this.userMaintenanceService.GetClientloginsByClientID(params);
|
||||
}
|
||||
|
||||
@Post('CreateClientLogins')
|
||||
@ -91,11 +91,4 @@ export class UserMaintenanceController {
|
||||
return this.userMaintenanceService.GetCarnetSummaryData(params);
|
||||
}
|
||||
|
||||
// [carnetcontrolcenter_pkg]
|
||||
|
||||
@Get('GetCarnetDetailsbyCarnetStatus/:P_SPID/:P_USERID/:P_CARNETSTATUS')
|
||||
@Roles('pca', 'psa', 'pua')
|
||||
GetCarnetDetailsbyCarnetStatus(@Param() params: GetCarnetDetailsbyCarnetStatusDTO) {
|
||||
return this.userMaintenanceService.GetCarnetDetailsbyCarnetStatus(params);
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,10 +64,10 @@ export class UserMaintenanceService {
|
||||
checkPgUserDefinedErrors(userDetailsResult);
|
||||
|
||||
return {
|
||||
roleDetails: toUpperCaseKeys(roleResult.rows),
|
||||
menuDetails: toUpperCaseKeys(menuResult.rows),
|
||||
roleDetails: toUpperCaseKeys(roleResult.rows).map(x => x.ROLENAME),
|
||||
menuDetails: toUpperCaseKeys(menuResult.rows).map(x => x.MENUNAME),
|
||||
menuPageDetails: toUpperCaseKeys(menuPageResult.rows),
|
||||
userDetails: toUpperCaseKeys(userDetailsResult.rows),
|
||||
userDetails: toUpperCaseKeys(userDetailsResult.rows)[0],
|
||||
};
|
||||
} catch (error) {
|
||||
if (client) await client.query('ROLLBACK');
|
||||
@ -107,11 +107,13 @@ export class UserMaintenanceService {
|
||||
|
||||
checkPgUserDefinedErrors(fetchResult);
|
||||
|
||||
return {
|
||||
statusCode: 201,
|
||||
message: ResponseStatus.lockedUserDone,
|
||||
...toUpperCaseKeys(fetchResult?.rows)[0]
|
||||
};
|
||||
// return {
|
||||
// statusCode: 201,
|
||||
// message: ResponseStatus.lockedUserDone,
|
||||
// ...toUpperCaseKeys(fetchResult?.rows)[0]
|
||||
// };
|
||||
|
||||
return toUpperCaseKeys(fetchResult?.rows)
|
||||
|
||||
} catch (error) {
|
||||
if (client) await client.query('ROLLBACK');
|
||||
@ -447,7 +449,7 @@ export class UserMaintenanceService {
|
||||
checkPgUserDefinedErrors(fetchResult);
|
||||
|
||||
if (fetchResult?.rows.length > 0) {
|
||||
return [toUpperCaseKeys(fetchResult.rows)[0]]
|
||||
return toUpperCaseKeys(fetchResult.rows)
|
||||
}
|
||||
else {
|
||||
return [];
|
||||
@ -552,38 +554,5 @@ export class UserMaintenanceService {
|
||||
}
|
||||
}
|
||||
|
||||
async GetCarnetDetailsbyCarnetStatus(body: GetCarnetDetailsbyCarnetStatusDTO) {
|
||||
|
||||
let client: PoolClient | null = null;
|
||||
|
||||
const cursorName = 'p_cursor';
|
||||
|
||||
try {
|
||||
client = await this.pgDBService.getConnection();
|
||||
|
||||
await client.query('BEGIN');
|
||||
|
||||
const callProcQuery = `
|
||||
CALL "CARNETSYS".carnetcontrolcenter_pkg_getcarnetdetails($1, $2, $3, $4)
|
||||
`;
|
||||
await client.query(callProcQuery, [body.P_SPID, body.P_USERID, body.P_CARNETSTATUS, cursorName]);
|
||||
|
||||
// 🚫 DON'T quote the cursor name in FETCH
|
||||
const fetchResult = await client.query(`FETCH ALL FROM ${cursorName}`);
|
||||
|
||||
// 🚫 DON'T quote the cursor name in CLOSE
|
||||
await client.query(`CLOSE ${cursorName}`);
|
||||
await client.query('COMMIT');
|
||||
|
||||
checkPgUserDefinedErrors(fetchResult);
|
||||
|
||||
return toUpperCaseKeys(fetchResult.rows);
|
||||
|
||||
} catch (error) {
|
||||
if (client) await client.query('ROLLBACK');
|
||||
handlePgError(error, UserMaintenanceService.name)
|
||||
} finally {
|
||||
releasePgClient(client)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user