CARNETCONTROLCENTER_PKG API
This commit is contained in:
parent
49fe236b30
commit
f2d095098c
@ -395,7 +395,7 @@ export class AuthService {
|
||||
let adminAccessToken = await this.getAdminAccessToken();
|
||||
|
||||
console.log(`${this.USERS_URL}/${userDetails.id}/reset-password`);
|
||||
|
||||
|
||||
|
||||
const options2: AxiosRequestConfig = {
|
||||
method: 'PUT',
|
||||
@ -834,6 +834,8 @@ export class AuthService {
|
||||
|
||||
userDetails = await this.getUserDetailsByEmail(body.P_TO);
|
||||
|
||||
ROLE = userDetails.role[0];
|
||||
|
||||
} catch (error) {
|
||||
if (error instanceof BadRequestException) {
|
||||
throw error
|
||||
@ -845,6 +847,8 @@ export class AuthService {
|
||||
|
||||
token = await this.generateToken({ P_TO: body.P_TO, uuid: uuid })
|
||||
|
||||
|
||||
|
||||
const mailTemplate: MailTemplateDTO | null = await this.getMailTemplate(body, token, ROLE);
|
||||
|
||||
if (!mailTemplate) {
|
||||
@ -852,7 +856,7 @@ export class AuthService {
|
||||
}
|
||||
|
||||
try {
|
||||
// await this.mailService.sendMail({ ...mailTemplate });
|
||||
await this.mailService.sendMail({ ...mailTemplate });
|
||||
console.log('Email sent successfully');
|
||||
|
||||
if (body.P_MAIL_TYPE === MailTypeDTO.FORGOT_PASSWORD) {
|
||||
|
||||
@ -30,6 +30,7 @@ export class HEADERID_DTO {
|
||||
@Min(0, { message: 'Property P_HEADERID must be at least 0 or more' })
|
||||
@IsInt({ message: 'Property P_HEADERID allows only whole numbers' })
|
||||
@IsNumber({}, { message: 'Property P_HEADERID must be a number' })
|
||||
@Transform(({ value }) => Number(value))
|
||||
@IsDefined({ message: 'Property P_HEADERID is required' })
|
||||
P_HEADERID: number;
|
||||
}
|
||||
|
||||
@ -82,3 +82,7 @@ export class UpdateShippingDetailsDTO extends IntersectionType(
|
||||
PAYMENTMETHOD_DTO, CUSTCOURIERNO_DTO, REFNO_DTO, NOTES_DTO, USERID_DTO
|
||||
) { }
|
||||
|
||||
export class GetCarnetControlCenterDTO extends IntersectionType(
|
||||
SPID_DTO, USERID_DTO, HEADERID_DTO
|
||||
) { }
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Body, Controller, Patch, Post, Put, UseGuards } from '@nestjs/common';
|
||||
import { Body, Controller, Get, Param, Patch, Post, Put, UseGuards } from '@nestjs/common';
|
||||
import { CarnetApplicationService } from './carnet-application.service';
|
||||
import { ApiTags } from '@nestjs/swagger';
|
||||
|
||||
@ -7,7 +7,7 @@ import {
|
||||
AddCountriesDTO,
|
||||
AddGenerallistItemsDTO,
|
||||
CA_UpdateHolderDTO,
|
||||
CarnetProcessingCenterDTO, CreateApplicationDTO, SaveCarnetApplicationDTO, TransmitApplicationtoProcessDTO,
|
||||
CarnetProcessingCenterDTO, CreateApplicationDTO, GetCarnetControlCenterDTO, SaveCarnetApplicationDTO, TransmitApplicationtoProcessDTO,
|
||||
UpdateExpGoodsAuthRepDTO,
|
||||
UpdateShippingDetailsDTO
|
||||
} from 'src/dto/property.dto';
|
||||
@ -97,4 +97,27 @@ export class CarnetApplicationController {
|
||||
CloseCarnet(@Body() body: CarnetProcessingCenterDTO) {
|
||||
return this.carnetApplicationService.CloseCarnet(body);
|
||||
}
|
||||
|
||||
// [ CARNETCONTROLCENTER_PKG ]
|
||||
|
||||
@Get('GetHolderstoEdit/:P_SPID/:P_USERID/:P_HEADERID')
|
||||
GetHolderstoEdit(@Param() body: GetCarnetControlCenterDTO) {
|
||||
return this.carnetApplicationService.GetHolderstoEdit(body);
|
||||
}
|
||||
|
||||
@Get('GetGoodsDetailstoEdit/:P_SPID/:P_USERID/:P_HEADERID')
|
||||
GetGoodsDetailstoEdit(@Param() body: GetCarnetControlCenterDTO) {
|
||||
return this.carnetApplicationService.GetHolderstoEdit(body);
|
||||
}
|
||||
|
||||
@Get('GetCountryDetailstoEdit/:P_SPID/:P_USERID/:P_HEADERID')
|
||||
GetCountryDetailstoEdit(@Param() body: GetCarnetControlCenterDTO) {
|
||||
return this.carnetApplicationService.GetHolderstoEdit(body);
|
||||
}
|
||||
|
||||
@Get('GetShipPaymentDetailstoEdit/:P_SPID/:P_USERID/:P_HEADERID')
|
||||
GetShipPaymentDetailstoEdit(@Param() body: GetCarnetControlCenterDTO) {
|
||||
return this.carnetApplicationService.GetHolderstoEdit(body);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -11,7 +11,8 @@ import {
|
||||
AddGenerallistItemsDTO,
|
||||
AddCountriesDTO,
|
||||
UpdateShippingDetailsDTO,
|
||||
CA_UpdateHolderDTO
|
||||
CA_UpdateHolderDTO,
|
||||
GetCarnetControlCenterDTO
|
||||
} from 'src/dto/property.dto';
|
||||
import { OracleService } from '../oracle.service';
|
||||
|
||||
@ -691,4 +692,144 @@ export class CarnetApplicationService {
|
||||
}
|
||||
}
|
||||
|
||||
// [ CARNETCONTROLCENTER_PKG ]
|
||||
|
||||
async GetHolderstoEdit(body: GetCarnetControlCenterDTO) {
|
||||
|
||||
let connection;
|
||||
|
||||
try {
|
||||
connection = await this.oracleDBService.getConnection();
|
||||
|
||||
const result = await connection.execute(
|
||||
`BEGIN
|
||||
CARNETCONTROLCENTER_PKG.GetHolderstoEdit(
|
||||
: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)
|
||||
}
|
||||
|
||||
}
|
||||
async GetGoodsDetailstoEdit(body: GetCarnetControlCenterDTO) {
|
||||
let connection;
|
||||
|
||||
try {
|
||||
connection = await this.oracleDBService.getConnection();
|
||||
|
||||
const result = await connection.execute(
|
||||
`BEGIN
|
||||
CARNETCONTROLCENTER_PKG.GetGoodsDetailstoEdit(
|
||||
: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)
|
||||
}
|
||||
}
|
||||
async GetCountryDetailstoEdit(body: GetCarnetControlCenterDTO) {
|
||||
let connection;
|
||||
|
||||
try {
|
||||
connection = await this.oracleDBService.getConnection();
|
||||
|
||||
const result = await connection.execute(
|
||||
`BEGIN
|
||||
CARNETCONTROLCENTER_PKG.GetCountryDetailstoEdit(
|
||||
: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)
|
||||
}
|
||||
}
|
||||
async GetShipPaymentDetailstoEdit(body: GetCarnetControlCenterDTO) {
|
||||
let connection;
|
||||
|
||||
try {
|
||||
connection = await this.oracleDBService.getConnection();
|
||||
|
||||
const result = await connection.execute(
|
||||
`BEGIN
|
||||
CARNETCONTROLCENTER_PKG.GetShipPaymentDetailstoEdit(
|
||||
: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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user