new api in carnet application and modification

This commit is contained in:
Kallesh B S 2025-07-09 17:23:17 +05:30
parent 2259d306b1
commit 0cd9b8ca85
10 changed files with 371 additions and 66 deletions

View File

@ -44,10 +44,10 @@ export class AuthController {
return { statusCode: 200, message: "Logged-In Successfully", email: k.email }
}
@UseGuards(RegisterGuard)
// @UseGuards(RegisterGuard)
@Post('register')
async register(@Body() body: AuthLoginDTO, @Req() req: Request) {
return this.authService.registerUser(body, req);
async register(@Body() body: AuthLoginDTO) {
return this.authService.registerUser(body);
}
@UseInterceptors(LogoutInterceptor)

View File

@ -459,11 +459,18 @@ export class AuthService {
}
}
async registerUser(body: AuthLoginDTO, req: Request) {
let det = await req['user'];
if (det?.email !== body.P_EMAILADDR) {
async registerUser(body: AuthLoginDTO) {
// let det = await req['user'];
// if (det?.email !== body.P_EMAILADDR) {
// throw new BadRequestException();
// }
const response: any = await this.userMaintenanceService.ValidateEmail({ P_EMAILADDR: body.P_EMAILADDR })
if (Array.isArray(response) && response[0].ERRORMESG) {
throw new BadRequestException();
}
const userPayload = {
username: body.P_EMAILADDR,
// firstName:"A",
@ -501,8 +508,6 @@ export class AuthService {
let ROLE = "";
const response: any = await this.userMaintenanceService.ValidateEmail({ P_EMAILADDR: body.P_EMAILADDR })
if (Array.isArray(response) && !response[0].ERRORMESG) {
switch (response[0].SOURCE) {
@ -511,9 +516,7 @@ export class AuthService {
case "CLIENT": ROLE = 'ca'; break;
}
}
else if (Array.isArray(response) && response[0].ERRORMESG) {
throw new BadRequestException();
}
if (!ROLE) {
console.log("ERROR while giving access : ");
@ -708,7 +711,7 @@ export class AuthService {
template: 'a',
context: {
to: body.P_TO,
url: `https://client.alphaomegainfosys.com/register/${token}`
url: `https://client.alphaomegainfosys.com/register`
}
}
case MailTypeDTO.FORGOT_PASSWORD:
@ -847,8 +850,6 @@ 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) {

View File

@ -120,6 +120,10 @@ export class GetClientDTO extends IntersectionType(
CLIENTID_DTO
) { }
export class GetClientContactByLacationIdDTO extends IntersectionType(
SPID_DTO, LOCATIONID_DTO
){}
export class ClientContactControlsDTO extends IntersectionType(
SPID_DTO,
CLIENT_CONTACTID_DTO,

View File

@ -17,28 +17,32 @@ import { HandlebarsAdapter } from '@nestjs-modules/mailer/dist/adapters/handleba
MailerModule.forRootAsync({
imports: [ConfigModule],
useFactory: (configService: ConfigService) => ({
transport: {
host: 'smtp.gmail.com',
port: 587,
// ignoreTLS: true,
secure: false,
auth: {
user: configService.get<string>('MAIL_USER'),
pass: configService.get<string>('MAIL_PASS'),
useFactory: (configService: ConfigService) => {
const templatePath = join(__dirname, '../../..', 'public', 'mail-templates');
console.log('Resolved mail template path:', templatePath);
return {
transport: {
host: 'smtp.gmail.com',
port: 587,
secure: false,
auth: {
user: configService.get<string>('MAIL_USER'),
pass: configService.get<string>('MAIL_PASS'),
},
},
},
defaults: {
from: `"Carnet APP" <${configService.get<string>('MAIL_USER')}>`,
},
template: {
dir: join(__dirname, '../../..', 'public', 'mail-templates'),
adapter: new HandlebarsAdapter(), // import from '@nestjs-modules/mailer/dist/adapters/handlebars.adapter'
options: {
strict: true,
defaults: {
from: `"Carnet APP" <${configService.get<string>('MAIL_USER')}>`,
},
},
}),
template: {
dir: templatePath,
adapter: new HandlebarsAdapter(),
options: {
strict: true,
},
},
};
},
inject: [ConfigService],
}),
],

View File

@ -1,4 +1,4 @@
import { Body, Controller, Get, Param, Patch, Post, Put, UseGuards } from '@nestjs/common';
import { Body, Controller, Delete, Get, Param, Patch, Post, Put, UseGuards } from '@nestjs/common';
import { CarnetApplicationService } from './carnet-application.service';
import { ApiTags } from '@nestjs/swagger';
@ -63,6 +63,16 @@ export class CarnetApplicationController {
return this.carnetApplicationService.AddCountries(body);
}
@Put('EditGenerallistItems')
EditGenerallistItems(@Body() body: AddGenerallistItemsDTO) {
return this.carnetApplicationService.EditGenerallistItems(body);
}
@Delete('DeleteGenerallistItems')
DeleteGenerallistItems(@Body() body: AddGenerallistItemsDTO) {
return this.carnetApplicationService.DeleteGenerallistItems(body);
}
@Patch('UpdateShippingDetails')
UpdateShippingDetails(@Body() body: UpdateShippingDetailsDTO) {
return this.carnetApplicationService.UpdateShippingDetails(body);
@ -110,11 +120,19 @@ export class CarnetApplicationController {
return this.carnetApplicationService.GetGoodsDetailstoEdit(body);
}
@Get('GetGoodsItemstoEdit/:P_SPID/:P_USERID/:P_HEADERID')
GetGoodsItemstoEdit(@Param() body: GetCarnetControlCenterDTO) {
return this.carnetApplicationService.GetGoodsItemstoEdit(body);
}
@Get('GetCountryDetailstoEdit/:P_SPID/:P_USERID/:P_HEADERID')
GetCountryDetailstoEdit(@Param() body: GetCarnetControlCenterDTO) {
return this.carnetApplicationService.GetCountryDetailstoEdit(body);
}
@Get('GetShipPaymentDetailstoEdit/:P_SPID/:P_USERID/:P_HEADERID')
GetShipPaymentDetailstoEdit(@Param() body: GetCarnetControlCenterDTO) {
return this.carnetApplicationService.GetShipPaymentDetailstoEdit(body);

View File

@ -219,7 +219,14 @@ export class CarnetApplicationService {
throw new InternalServerException("Incomplete data received from the database.");
}
return await fetchCursor(outBinds.P_CURSOR, CarnetApplicationService.name);
const fres: any = await fetchCursor(outBinds.P_CURSOR, CarnetApplicationService.name);
if (fres.length > 0 && fres[0].ERRORMESG) {
this.logger.warn(fres[0].ERRORMESG);
throw new BadRequestException(fres[0].ERRORMESG)
}
return { statusCode: 200, message: "Saved Successfully", ...fres[0] };
} catch (error) {
handleError(error, CarnetApplicationService.name)
} finally {
@ -256,7 +263,14 @@ export class CarnetApplicationService {
throw new InternalServerException("Incomplete data received from the database.");
}
return await fetchCursor(outBinds.P_CURSOR, CarnetApplicationService.name);
const fres: any = await fetchCursor(outBinds.P_CURSOR, CarnetApplicationService.name);
if (fres.length > 0 && fres[0].ERRORMESG) {
this.logger.warn(fres[0].ERRORMESG);
throw new BadRequestException(fres[0].ERRORMESG)
}
return { statusCode: 200, message: "Transmitted Successfully", ...fres[0] };
} catch (error) {
handleError(error, CarnetApplicationService.name)
} finally {
@ -340,7 +354,15 @@ export class CarnetApplicationService {
throw new InternalServerException("Incomplete data received from the database.");
}
return await fetchCursor(outBinds.P_ERRORMESG, CarnetApplicationService.name);
// return await fetchCursor(outBinds.P_ERRORMESG, CarnetApplicationService.name);
const fres: any = await fetchCursor(outBinds.P_ERRORMESG, CarnetApplicationService.name);
if (fres.length > 0 && fres[0].ERRORMESG) {
this.logger.warn(fres[0].ERRORMESG);
throw new BadRequestException(fres[0].ERRORMESG)
}
return { statusCode: 200, message: "Updated Successfully", ...fres[0] };
} catch (error) {
handleError(error, CarnetApplicationService.name)
} finally {
@ -383,7 +405,14 @@ export class CarnetApplicationService {
throw new InternalServerException("Incomplete data received from the database.");
}
return await fetchCursor(outBinds.P_ERRORMESG, CarnetApplicationService.name);
const fres: any = await fetchCursor(outBinds.P_ERRORMESG, CarnetApplicationService.name);
if (fres.length > 0 && fres[0].ERRORMESG) {
this.logger.warn(fres[0].ERRORMESG);
throw new BadRequestException(fres[0].ERRORMESG)
}
return { statusCode: 200, message: "Updated Successfully", ...fres[0] };
} catch (error) {
handleError(error, CarnetApplicationService.name)
} finally {
@ -423,7 +452,109 @@ export class CarnetApplicationService {
throw new InternalServerException("Incomplete data received from the database.");
}
return await fetchCursor(outBinds.P_ERRORMESG, CarnetApplicationService.name);
// return await fetchCursor(outBinds.P_ERRORMESG, CarnetApplicationService.name);
const fres: any = await fetchCursor(outBinds.P_ERRORMESG, CarnetApplicationService.name);
if (fres.length > 0 && fres[0].ERRORMESG) {
this.logger.warn(fres[0].ERRORMESG);
throw new BadRequestException(fres[0].ERRORMESG)
}
return { statusCode: 200, message: "Added Successfully", ...fres[0] };
} catch (error) {
handleError(error, CarnetApplicationService.name)
} finally {
await closeOracleDbConnection(connection, CarnetApplicationService.name)
}
}
async EditGenerallistItems(body: AddGenerallistItemsDTO) {
let connection;
try {
connection = await this.oracleDBService.getConnection();
const GLTABLE_INSTANCE = await this.oracleService.get_GL_TABLE_INSTANCE(body);
const result = await connection.execute(
`BEGIN
CARNETAPPLICATION_PKG.EditGenerallistItems(
:P_HEADERID, :P_GLTABLE, :P_USERID, :P_CURSOR
);
END;`,
{
P_HEADERID: { val: body.P_HEADERID, type: oracledb.DB_TYPE_NUMBER },
P_GLTABLE: { val: GLTABLE_INSTANCE, type: 'CARNETSYS.GLTABLE' },
// P_GLTABLE: { val: GLTABLE_INSTANCE, type: oracledb.DB_TYPE_OBJECT },
P_USERID: { val: body.P_USERID, type: oracledb.DB_TYPE_NVARCHAR },
// P_ERRORMESG: { dir: oracledb.BIND_OUT, type: oracledb.CURSOR },
P_CURSOR: { type: oracledb.CURSOR, dir: oracledb.BIND_OUT }
},
{ outFormat: oracledb.OUT_FORMAT_OBJECT }
);
await connection.commit();
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.");
}
const fres: any = await fetchCursor(outBinds.P_CURSOR, CarnetApplicationService.name);
if (fres.length > 0 && fres[0].ERRORMESG) {
this.logger.warn(fres[0].ERRORMESG);
throw new BadRequestException(fres[0].ERRORMESG)
}
return { statusCode: 200, message: "Updated Successfully", ...fres[0] };
} catch (error) {
handleError(error, CarnetApplicationService.name)
} finally {
await closeOracleDbConnection(connection, CarnetApplicationService.name)
}
}
async DeleteGenerallistItems(body: AddGenerallistItemsDTO) {
let connection;
try {
connection = await this.oracleDBService.getConnection();
const GLTABLE_INSTANCE = await this.oracleService.get_GL_TABLE_INSTANCE(body);
const result = await connection.execute(
`BEGIN
CARNETAPPLICATION_PKG.DeleteGenerallistItems(
:P_HEADERID, :P_GLTABLE, :P_USERID, :P_CURSOR
);
END;`,
{
P_HEADERID: { val: body.P_HEADERID, type: oracledb.DB_TYPE_NUMBER },
P_GLTABLE: { val: GLTABLE_INSTANCE, type: 'CARNETSYS.GLTABLE' },
// P_GLTABLE: { val: GLTABLE_INSTANCE, type: oracledb.DB_TYPE_OBJECT },
P_USERID: { val: body.P_USERID, type: oracledb.DB_TYPE_NVARCHAR },
// P_ERRORMESG: { dir: oracledb.BIND_OUT, type: oracledb.CURSOR },
P_CURSOR: { type: oracledb.CURSOR, dir: oracledb.BIND_OUT }
},
{ outFormat: oracledb.OUT_FORMAT_OBJECT }
);
await connection.commit();
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.");
}
const fres: any = await fetchCursor(outBinds.P_CURSOR, CarnetApplicationService.name);
if (fres.length > 0 && fres[0].ERRORMESG) {
this.logger.warn(fres[0].ERRORMESG);
throw new BadRequestException(fres[0].ERRORMESG)
}
return { statusCode: 200, message: "Deleted Successfully", ...fres[0] };
} catch (error) {
handleError(error, CarnetApplicationService.name)
} finally {
@ -441,7 +572,7 @@ export class CarnetApplicationService {
const result = await connection.execute(
`BEGIN
CARNETAPPLICATION_PKG.AddCountries(
:P_HEADERID, :P_USSETS, :P_COUNTRYTABLE, :P_USERID, :P_ERRORMESG
:P_HEADERID, :P_USSETS, :P_COUNTRYTABLE, :P_USERID, :P_CURSOR
);
END;`,
{
@ -451,8 +582,8 @@ export class CarnetApplicationService {
// P_COUNTRYTABLE: { val: COUNTRYTABLE_INSTANCE, type: 'CARNETSYS.GLTABLE' },
// P_COUNTRYTABLE: { val: COUNTRYTABLE_INSTANCE, type: oracledb.DB_TYPE_OBJECT },
P_USERID: { val: body.P_USERID, type: oracledb.DB_TYPE_NVARCHAR },
P_ERRORMESG: { dir: oracledb.BIND_OUT, type: oracledb.CURSOR },
// P_CURSOR: { type: oracledb.CURSOR, dir: oracledb.BIND_OUT }
// P_ERRORMESG: { dir: oracledb.BIND_OUT, type: oracledb.CURSOR },
P_CURSOR: { type: oracledb.CURSOR, dir: oracledb.BIND_OUT }
},
{ outFormat: oracledb.OUT_FORMAT_OBJECT }
);
@ -460,12 +591,19 @@ export class CarnetApplicationService {
await connection.commit();
const outBinds = result.outBinds;
if (!outBinds?.P_ERRORMESG) {
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_ERRORMESG, CarnetApplicationService.name);
const fres: any = await fetchCursor(outBinds.P_CURSOR, CarnetApplicationService.name);
if (fres.length > 0 && fres[0].ERRORMESG) {
this.logger.warn(fres[0].ERRORMESG);
throw new BadRequestException(fres[0].ERRORMESG)
}
return { statusCode: 200, message: "Added Successfully", ...fres[0] };
} catch (error) {
handleError(error, CarnetApplicationService.name)
} finally {
@ -480,10 +618,10 @@ export class CarnetApplicationService {
const result = await connection.execute(
`BEGIN
CARNETAPPLICATION_PKG.UpdateHolder(
CARNETAPPLICATION_PKG.UpdateShippingDetails(
:P_HEADERID, :P_SHIPTOTYPE, :P_SHIPADDRID, :P_FORMOFSECURITY, :P_INSPROTECTION,
:P_LDIPROTECTION, :P_DELIVERYTYPE, :P_DELIVERYMETHOD, :P_PAYMENTMETHOD,
:P_CUSTCOURIERNO, :P_REFNO, :P_NOTES, :P_USERID, :P_ERRORMESG
:P_CUSTCOURIERNO, :P_REFNO, :P_NOTES, :P_USERID, :P_CURSOR
);
END;`,
{
@ -500,8 +638,8 @@ export class CarnetApplicationService {
P_REFNO: { val: body.P_REFNO, type: oracledb.DB_TYPE_NVARCHAR },
P_NOTES: { val: body.P_NOTES, type: oracledb.DB_TYPE_NVARCHAR },
P_USERID: { val: body.P_USERID, type: oracledb.DB_TYPE_NVARCHAR },
P_ERRORMESG: { dir: oracledb.BIND_OUT, type: oracledb.CURSOR },
// P_CURSOR: { type: oracledb.CURSOR, dir: oracledb.BIND_OUT }
// P_ERRORMESG: { dir: oracledb.BIND_OUT, type: oracledb.CURSOR },
P_CURSOR: { type: oracledb.CURSOR, dir: oracledb.BIND_OUT }
},
{ outFormat: oracledb.OUT_FORMAT_OBJECT }
);
@ -509,12 +647,19 @@ export class CarnetApplicationService {
await connection.commit();
const outBinds = result.outBinds;
if (!outBinds?.P_ERRORMESG) {
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_ERRORMESG, CarnetApplicationService.name);
const fres: any = await fetchCursor(outBinds.P_CURSOR, CarnetApplicationService.name);
if (fres.length > 0 && fres[0].ERRORMESG) {
this.logger.warn(fres[0].ERRORMESG);
throw new BadRequestException(fres[0].ERRORMESG)
}
return { statusCode: 200, message: "Updated Successfully", ...fres[0] };
} catch (error) {
handleError(error, CarnetApplicationService.name)
} finally {
@ -552,7 +697,14 @@ export class CarnetApplicationService {
throw new InternalServerException("Incomplete data received from the database.");
}
return await fetchCursor(outBinds.P_CURSOR, CarnetApplicationService.name);
const fres: any = await fetchCursor(outBinds.P_CURSOR, CarnetApplicationService.name);
if (fres.length > 0 && fres[0].ERRORMESG) {
this.logger.warn(fres[0].ERRORMESG);
throw new BadRequestException(fres[0].ERRORMESG)
}
return { statusCode: 200, message: "Processed Successfully", ...fres[0] };
} catch (error) {
handleError(error, CarnetApplicationService.name)
} finally {
@ -587,7 +739,14 @@ export class CarnetApplicationService {
throw new InternalServerException("Incomplete data received from the database.");
}
return await fetchCursor(outBinds.P_CURSOR, CarnetApplicationService.name);
const fres: any = await fetchCursor(outBinds.P_CURSOR, CarnetApplicationService.name);
if (fres.length > 0 && fres[0].ERRORMESG) {
this.logger.warn(fres[0].ERRORMESG);
throw new BadRequestException(fres[0].ERRORMESG)
}
return { statusCode: 200, message: "Updated Successfully", ...fres[0] };
} catch (error) {
handleError(error, CarnetApplicationService.name)
} finally {
@ -622,7 +781,14 @@ export class CarnetApplicationService {
throw new InternalServerException("Incomplete data received from the database.");
}
return await fetchCursor(outBinds.P_CURSOR, CarnetApplicationService.name);
const fres: any = await fetchCursor(outBinds.P_CURSOR, CarnetApplicationService.name);
if (fres.length > 0 && fres[0].ERRORMESG) {
this.logger.warn(fres[0].ERRORMESG);
throw new BadRequestException(fres[0].ERRORMESG)
}
return { statusCode: 200, message: "Voided Successfully", ...fres[0] };
} catch (error) {
handleError(error, CarnetApplicationService.name)
} finally {
@ -657,7 +823,14 @@ export class CarnetApplicationService {
throw new InternalServerException("Incomplete data received from the database.");
}
return await fetchCursor(outBinds.P_CURSOR, CarnetApplicationService.name);
const fres: any = await fetchCursor(outBinds.P_CURSOR, CarnetApplicationService.name);
if (fres.length > 0 && fres[0].ERRORMESG) {
this.logger.warn(fres[0].ERRORMESG);
throw new BadRequestException(fres[0].ERRORMESG)
}
return { statusCode: 200, message: "Duplicated Successfully", ...fres[0] };
} catch (error) {
handleError(error, CarnetApplicationService.name)
} finally {
@ -692,7 +865,14 @@ export class CarnetApplicationService {
throw new InternalServerException("Incomplete data received from the database.");
}
return await fetchCursor(outBinds.P_CURSOR, CarnetApplicationService.name);
const fres: any = await fetchCursor(outBinds.P_CURSOR, CarnetApplicationService.name);
if (fres.length > 0 && fres[0].ERRORMESG) {
this.logger.warn(fres[0].ERRORMESG);
throw new BadRequestException(fres[0].ERRORMESG)
}
return { statusCode: 200, message: "Closed Successfully", ...fres[0] };
} catch (error) {
handleError(error, CarnetApplicationService.name)
} finally {
@ -840,4 +1020,39 @@ export class CarnetApplicationService {
await closeOracleDbConnection(connection, CarnetApplicationService.name)
}
}
async GetGoodsItemstoEdit(body: GetCarnetControlCenterDTO) {
let connection;
try {
connection = await this.oracleDBService.getConnection();
const result = await connection.execute(
`BEGIN
CARNETCONTROLCENTER_PKG.GetGoodsItemstoEdit(
: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)
}
}
}

View File

@ -132,27 +132,46 @@ export class HomePageService {
// Step 2: Group and aggregate
const reducedRows = mappedRows.reduce((acc, curr) => {
const existing = acc.find(
(item) =>
item['Service_Provider_Name'] === curr['Service_Provider_Name'] &&
item.SPID === curr.SPID
);
let existing;
if (curr.Service_Provider_Name && curr.SPID) {
existing = acc.find(
(item) =>
item.Service_Provider_Name === curr.Service_Provider_Name &&
item.SPID === curr.SPID
);
} else if (curr.Preparer_Name && curr.CLIENTID) {
existing = acc.find(
(item) =>
item.Preparer_Name === curr.Preparer_Name &&
item.CLIENTID === curr.CLIENTID
);
}
if (existing) {
existing.CARNETSTATUS.push(curr.CARNETSTATUS);
existing.Carnet_Count.push(curr.Carnet_Count);
} else {
acc.push({
Service_Provider_Name: curr.Service_Provider_Name,
SPID: curr.SPID,
const newItem = {
CARNETSTATUS: [curr.CARNETSTATUS],
Carnet_Count: [curr.Carnet_Count],
});
};
if (curr.Service_Provider_Name && curr.SPID) {
newItem['Service_Provider_Name'] = curr.Service_Provider_Name;
newItem['SPID'] = curr.SPID;
} else if (curr.Preparer_Name && curr.CLIENTID) {
newItem['Preparer_Name'] = curr.Preparer_Name;
newItem['CLIENTID'] = curr.CLIENTID;
}
acc.push(newItem);
}
return acc;
}, []);
return reducedRows;
} catch (error) {
handleError(error, HomePageService.name)

View File

@ -6,6 +6,7 @@ import {
ClientContactControlsDTO,
CreateClientContactsDTO, CreateClientDataDTO,
CreateClientLocationsDTO,
GetClientContactByLacationIdDTO,
GetClientDTO,
GetPreparersParamDTO, GetPreparersQueryDTO, UpdateClientContactsDTO, UpdateClientDTO, UpdateClientLocationsDTO
} from 'src/dto/property.dto';
@ -81,6 +82,11 @@ export class ManageClientsController {
return this.manageClientsService.GetPreparerContactsByClientid(body);
}
@Get('GetPreparerContactsbyClientLocationID/:P_SPID/:P_LOCATIONID')
GetPreparerContactsbyClientLocationID(@Param() body: GetClientContactByLacationIdDTO) {
return this.manageClientsService.GetPreparerContactsbyClientLocationID(body);
}
@Get('GetPreparerLocByClientid/:P_SPID/:P_CLIENTID')
GetPreparerLocByClientid(@Param() body: GetClientDTO) {
return this.manageClientsService.GetPreparerLocByClientid(body);

View File

@ -10,6 +10,7 @@ import {
ClientContactControlsDTO,
CreateClientContactsDTO, CreateClientDataDTO,
CreateClientLocationsDTO,
GetClientContactByLacationIdDTO,
GetClientDTO,
GetPreparersDTO, UpdateClientContactsDTO, UpdateClientDTO, UpdateClientLocationsDTO,
} from 'src/dto/property.dto';
@ -718,6 +719,43 @@ export class ManageClientsService {
}
};
GetPreparerContactsbyClientLocationID = async (body: GetClientContactByLacationIdDTO) => {
let connection;
try {
connection = await this.oracleDBService.getConnection();
const result = await connection.execute(
`BEGIN
MANAGEPREPARER_PKG.GetPreparerContactsByClientid(
:P_SPID, :P_LOCATIONID, :P_CURSOR
);
END;`,
{
P_SPID: { val: body.P_SPID, type: oracledb.DB_TYPE_NUMBER },
P_LOCATIONID: { val: body.P_LOCATIONID, type: oracledb.DB_TYPE_NUMBER },
P_CURSOR: { type: oracledb.CURSOR, dir: oracledb.BIND_OUT }
},
{
outFormat: oracledb.OUT_FORMAT_OBJECT,
},
);
const outBinds: any = 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, ManageClientsService.name);
} catch (error) {
handleError(error, ManageClientsService.name)
} finally {
await closeOracleDbConnection(connection, ManageClientsService.name)
}
}
GetPreparerLocByClientid = async (body: GetClientDTO) => {
let connection;

View File

@ -485,7 +485,7 @@ export class ManageHoldersService {
throw new BadRequestException(fres[0].ERRORMESG)
}
return { statusCode: 200, message: 'Reactivated holder successfully' };
return { statusCode: 200, message: 'Inactivated holder successfully' };
} catch (error) {
handleError(error, ManageHoldersService.name)
} finally {