new api in carnet application and modification
This commit is contained in:
parent
2259d306b1
commit
1e98dd0be9
@ -44,7 +44,7 @@ export class AuthController {
|
|||||||
return { statusCode: 200, message: "Logged-In Successfully", email: k.email }
|
return { statusCode: 200, message: "Logged-In Successfully", email: k.email }
|
||||||
}
|
}
|
||||||
|
|
||||||
@UseGuards(RegisterGuard)
|
// @UseGuards(RegisterGuard)
|
||||||
@Post('register')
|
@Post('register')
|
||||||
async register(@Body() body: AuthLoginDTO, @Req() req: Request) {
|
async register(@Body() body: AuthLoginDTO, @Req() req: Request) {
|
||||||
return this.authService.registerUser(body, req);
|
return this.authService.registerUser(body, req);
|
||||||
|
|||||||
@ -708,7 +708,7 @@ export class AuthService {
|
|||||||
template: 'a',
|
template: 'a',
|
||||||
context: {
|
context: {
|
||||||
to: body.P_TO,
|
to: body.P_TO,
|
||||||
url: `https://client.alphaomegainfosys.com/register/${token}`
|
url: `https://client.alphaomegainfosys.com/register`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case MailTypeDTO.FORGOT_PASSWORD:
|
case MailTypeDTO.FORGOT_PASSWORD:
|
||||||
@ -847,8 +847,6 @@ export class AuthService {
|
|||||||
|
|
||||||
token = await this.generateToken({ P_TO: body.P_TO, uuid: uuid })
|
token = await this.generateToken({ P_TO: body.P_TO, uuid: uuid })
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const mailTemplate: MailTemplateDTO | null = await this.getMailTemplate(body, token, ROLE);
|
const mailTemplate: MailTemplateDTO | null = await this.getMailTemplate(body, token, ROLE);
|
||||||
|
|
||||||
if (!mailTemplate) {
|
if (!mailTemplate) {
|
||||||
|
|||||||
@ -120,6 +120,10 @@ export class GetClientDTO extends IntersectionType(
|
|||||||
CLIENTID_DTO
|
CLIENTID_DTO
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
|
export class GetClientContactByLacationIdDTO extends IntersectionType(
|
||||||
|
SPID_DTO, LOCATIONID_DTO
|
||||||
|
){}
|
||||||
|
|
||||||
export class ClientContactControlsDTO extends IntersectionType(
|
export class ClientContactControlsDTO extends IntersectionType(
|
||||||
SPID_DTO,
|
SPID_DTO,
|
||||||
CLIENT_CONTACTID_DTO,
|
CLIENT_CONTACTID_DTO,
|
||||||
|
|||||||
@ -17,28 +17,32 @@ import { HandlebarsAdapter } from '@nestjs-modules/mailer/dist/adapters/handleba
|
|||||||
|
|
||||||
MailerModule.forRootAsync({
|
MailerModule.forRootAsync({
|
||||||
imports: [ConfigModule],
|
imports: [ConfigModule],
|
||||||
useFactory: (configService: ConfigService) => ({
|
useFactory: (configService: ConfigService) => {
|
||||||
transport: {
|
const templatePath = join(__dirname, '../../..', 'public', 'mail-templates');
|
||||||
host: 'smtp.gmail.com',
|
console.log('Resolved mail template path:', templatePath);
|
||||||
port: 587,
|
|
||||||
// ignoreTLS: true,
|
return {
|
||||||
secure: false,
|
transport: {
|
||||||
auth: {
|
host: 'smtp.gmail.com',
|
||||||
user: configService.get<string>('MAIL_USER'),
|
port: 587,
|
||||||
pass: configService.get<string>('MAIL_PASS'),
|
secure: false,
|
||||||
|
auth: {
|
||||||
|
user: configService.get<string>('MAIL_USER'),
|
||||||
|
pass: configService.get<string>('MAIL_PASS'),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
defaults: {
|
||||||
defaults: {
|
from: `"Carnet APP" <${configService.get<string>('MAIL_USER')}>`,
|
||||||
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,
|
|
||||||
},
|
},
|
||||||
},
|
template: {
|
||||||
}),
|
dir: templatePath,
|
||||||
|
adapter: new HandlebarsAdapter(),
|
||||||
|
options: {
|
||||||
|
strict: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
inject: [ConfigService],
|
inject: [ConfigService],
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
|
|||||||
@ -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 { CarnetApplicationService } from './carnet-application.service';
|
||||||
import { ApiTags } from '@nestjs/swagger';
|
import { ApiTags } from '@nestjs/swagger';
|
||||||
|
|
||||||
@ -63,6 +63,16 @@ export class CarnetApplicationController {
|
|||||||
return this.carnetApplicationService.AddCountries(body);
|
return this.carnetApplicationService.AddCountries(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Put('EditGenerallistItems')
|
||||||
|
EditGenerallistItems(@Body() body: AddGenerallistItemsDTO) {
|
||||||
|
return this.carnetApplicationService.EditGenerallistItems(body);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Delete('DeleteGenerallistItems')
|
||||||
|
DeleteGenerallistItems() {
|
||||||
|
return this.carnetApplicationService.DeleteGenerallistItems();
|
||||||
|
}
|
||||||
|
|
||||||
@Patch('UpdateShippingDetails')
|
@Patch('UpdateShippingDetails')
|
||||||
UpdateShippingDetails(@Body() body: UpdateShippingDetailsDTO) {
|
UpdateShippingDetails(@Body() body: UpdateShippingDetailsDTO) {
|
||||||
return this.carnetApplicationService.UpdateShippingDetails(body);
|
return this.carnetApplicationService.UpdateShippingDetails(body);
|
||||||
@ -110,11 +120,19 @@ export class CarnetApplicationController {
|
|||||||
return this.carnetApplicationService.GetGoodsDetailstoEdit(body);
|
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')
|
@Get('GetCountryDetailstoEdit/:P_SPID/:P_USERID/:P_HEADERID')
|
||||||
GetCountryDetailstoEdit(@Param() body: GetCarnetControlCenterDTO) {
|
GetCountryDetailstoEdit(@Param() body: GetCarnetControlCenterDTO) {
|
||||||
return this.carnetApplicationService.GetCountryDetailstoEdit(body);
|
return this.carnetApplicationService.GetCountryDetailstoEdit(body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Get('GetShipPaymentDetailstoEdit/:P_SPID/:P_USERID/:P_HEADERID')
|
@Get('GetShipPaymentDetailstoEdit/:P_SPID/:P_USERID/:P_HEADERID')
|
||||||
GetShipPaymentDetailstoEdit(@Param() body: GetCarnetControlCenterDTO) {
|
GetShipPaymentDetailstoEdit(@Param() body: GetCarnetControlCenterDTO) {
|
||||||
return this.carnetApplicationService.GetShipPaymentDetailstoEdit(body);
|
return this.carnetApplicationService.GetShipPaymentDetailstoEdit(body);
|
||||||
|
|||||||
@ -219,7 +219,14 @@ export class CarnetApplicationService {
|
|||||||
throw new InternalServerException("Incomplete data received from the database.");
|
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) {
|
} catch (error) {
|
||||||
handleError(error, CarnetApplicationService.name)
|
handleError(error, CarnetApplicationService.name)
|
||||||
} finally {
|
} finally {
|
||||||
@ -256,7 +263,14 @@ export class CarnetApplicationService {
|
|||||||
throw new InternalServerException("Incomplete data received from the database.");
|
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) {
|
} catch (error) {
|
||||||
handleError(error, CarnetApplicationService.name)
|
handleError(error, CarnetApplicationService.name)
|
||||||
} finally {
|
} finally {
|
||||||
@ -340,7 +354,15 @@ export class CarnetApplicationService {
|
|||||||
throw new InternalServerException("Incomplete data received from the database.");
|
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) {
|
} catch (error) {
|
||||||
handleError(error, CarnetApplicationService.name)
|
handleError(error, CarnetApplicationService.name)
|
||||||
} finally {
|
} finally {
|
||||||
@ -383,7 +405,14 @@ export class CarnetApplicationService {
|
|||||||
throw new InternalServerException("Incomplete data received from the database.");
|
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) {
|
} catch (error) {
|
||||||
handleError(error, CarnetApplicationService.name)
|
handleError(error, CarnetApplicationService.name)
|
||||||
} finally {
|
} finally {
|
||||||
@ -423,7 +452,15 @@ export class CarnetApplicationService {
|
|||||||
throw new InternalServerException("Incomplete data received from the database.");
|
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) {
|
} catch (error) {
|
||||||
handleError(error, CarnetApplicationService.name)
|
handleError(error, CarnetApplicationService.name)
|
||||||
} finally {
|
} finally {
|
||||||
@ -431,6 +468,55 @@ export class CarnetApplicationService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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() { }
|
||||||
|
|
||||||
async AddCountries(body: AddCountriesDTO) {
|
async AddCountries(body: AddCountriesDTO) {
|
||||||
let connection;
|
let connection;
|
||||||
try {
|
try {
|
||||||
@ -441,7 +527,7 @@ export class CarnetApplicationService {
|
|||||||
const result = await connection.execute(
|
const result = await connection.execute(
|
||||||
`BEGIN
|
`BEGIN
|
||||||
CARNETAPPLICATION_PKG.AddCountries(
|
CARNETAPPLICATION_PKG.AddCountries(
|
||||||
:P_HEADERID, :P_USSETS, :P_COUNTRYTABLE, :P_USERID, :P_ERRORMESG
|
:P_HEADERID, :P_USSETS, :P_COUNTRYTABLE, :P_USERID, :P_CURSOR
|
||||||
);
|
);
|
||||||
END;`,
|
END;`,
|
||||||
{
|
{
|
||||||
@ -451,8 +537,8 @@ export class CarnetApplicationService {
|
|||||||
// P_COUNTRYTABLE: { val: COUNTRYTABLE_INSTANCE, type: 'CARNETSYS.GLTABLE' },
|
// P_COUNTRYTABLE: { val: COUNTRYTABLE_INSTANCE, type: 'CARNETSYS.GLTABLE' },
|
||||||
// P_COUNTRYTABLE: { val: COUNTRYTABLE_INSTANCE, type: oracledb.DB_TYPE_OBJECT },
|
// P_COUNTRYTABLE: { val: COUNTRYTABLE_INSTANCE, type: oracledb.DB_TYPE_OBJECT },
|
||||||
P_USERID: { val: body.P_USERID, 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_ERRORMESG: { dir: oracledb.BIND_OUT, type: oracledb.CURSOR },
|
||||||
// P_CURSOR: { type: oracledb.CURSOR, dir: oracledb.BIND_OUT }
|
P_CURSOR: { type: oracledb.CURSOR, dir: oracledb.BIND_OUT }
|
||||||
},
|
},
|
||||||
{ outFormat: oracledb.OUT_FORMAT_OBJECT }
|
{ outFormat: oracledb.OUT_FORMAT_OBJECT }
|
||||||
);
|
);
|
||||||
@ -460,12 +546,19 @@ export class CarnetApplicationService {
|
|||||||
await connection.commit();
|
await connection.commit();
|
||||||
|
|
||||||
const outBinds = result.outBinds;
|
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.');
|
this.logger.error('One or more expected cursors are missing from stored procedure output.');
|
||||||
throw new InternalServerException("Incomplete data received from the database.");
|
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) {
|
} catch (error) {
|
||||||
handleError(error, CarnetApplicationService.name)
|
handleError(error, CarnetApplicationService.name)
|
||||||
} finally {
|
} finally {
|
||||||
@ -480,10 +573,10 @@ export class CarnetApplicationService {
|
|||||||
|
|
||||||
const result = await connection.execute(
|
const result = await connection.execute(
|
||||||
`BEGIN
|
`BEGIN
|
||||||
CARNETAPPLICATION_PKG.UpdateHolder(
|
CARNETAPPLICATION_PKG.UpdateShippingDetails(
|
||||||
:P_HEADERID, :P_SHIPTOTYPE, :P_SHIPADDRID, :P_FORMOFSECURITY, :P_INSPROTECTION,
|
:P_HEADERID, :P_SHIPTOTYPE, :P_SHIPADDRID, :P_FORMOFSECURITY, :P_INSPROTECTION,
|
||||||
:P_LDIPROTECTION, :P_DELIVERYTYPE, :P_DELIVERYMETHOD, :P_PAYMENTMETHOD,
|
: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;`,
|
END;`,
|
||||||
{
|
{
|
||||||
@ -500,8 +593,8 @@ export class CarnetApplicationService {
|
|||||||
P_REFNO: { val: body.P_REFNO, type: oracledb.DB_TYPE_NVARCHAR },
|
P_REFNO: { val: body.P_REFNO, type: oracledb.DB_TYPE_NVARCHAR },
|
||||||
P_NOTES: { val: body.P_NOTES, 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_USERID: { val: body.P_USERID, type: oracledb.DB_TYPE_NVARCHAR },
|
||||||
P_ERRORMESG: { dir: oracledb.BIND_OUT, type: oracledb.CURSOR },
|
// P_ERRORMESG: { dir: oracledb.BIND_OUT, type: oracledb.CURSOR },
|
||||||
// P_CURSOR: { type: oracledb.CURSOR, dir: oracledb.BIND_OUT }
|
P_CURSOR: { type: oracledb.CURSOR, dir: oracledb.BIND_OUT }
|
||||||
},
|
},
|
||||||
{ outFormat: oracledb.OUT_FORMAT_OBJECT }
|
{ outFormat: oracledb.OUT_FORMAT_OBJECT }
|
||||||
);
|
);
|
||||||
@ -509,12 +602,19 @@ export class CarnetApplicationService {
|
|||||||
await connection.commit();
|
await connection.commit();
|
||||||
|
|
||||||
const outBinds = result.outBinds;
|
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.');
|
this.logger.error('One or more expected cursors are missing from stored procedure output.');
|
||||||
throw new InternalServerException("Incomplete data received from the database.");
|
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) {
|
} catch (error) {
|
||||||
handleError(error, CarnetApplicationService.name)
|
handleError(error, CarnetApplicationService.name)
|
||||||
} finally {
|
} finally {
|
||||||
@ -840,4 +940,39 @@ export class CarnetApplicationService {
|
|||||||
await closeOracleDbConnection(connection, CarnetApplicationService.name)
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -132,11 +132,21 @@ export class HomePageService {
|
|||||||
|
|
||||||
// Step 2: Group and aggregate
|
// Step 2: Group and aggregate
|
||||||
const reducedRows = mappedRows.reduce((acc, curr) => {
|
const reducedRows = mappedRows.reduce((acc, curr) => {
|
||||||
const existing = acc.find(
|
let existing;
|
||||||
(item) =>
|
|
||||||
item['Service_Provider_Name'] === curr['Service_Provider_Name'] &&
|
if (curr.Service_Provider_Name && curr.SPID) {
|
||||||
item.SPID === 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) {
|
if (existing) {
|
||||||
existing.CARNETSTATUS.push(curr.CARNETSTATUS);
|
existing.CARNETSTATUS.push(curr.CARNETSTATUS);
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import {
|
|||||||
ClientContactControlsDTO,
|
ClientContactControlsDTO,
|
||||||
CreateClientContactsDTO, CreateClientDataDTO,
|
CreateClientContactsDTO, CreateClientDataDTO,
|
||||||
CreateClientLocationsDTO,
|
CreateClientLocationsDTO,
|
||||||
|
GetClientContactByLacationIdDTO,
|
||||||
GetClientDTO,
|
GetClientDTO,
|
||||||
GetPreparersParamDTO, GetPreparersQueryDTO, UpdateClientContactsDTO, UpdateClientDTO, UpdateClientLocationsDTO
|
GetPreparersParamDTO, GetPreparersQueryDTO, UpdateClientContactsDTO, UpdateClientDTO, UpdateClientLocationsDTO
|
||||||
} from 'src/dto/property.dto';
|
} from 'src/dto/property.dto';
|
||||||
@ -81,6 +82,11 @@ export class ManageClientsController {
|
|||||||
return this.manageClientsService.GetPreparerContactsByClientid(body);
|
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')
|
@Get('GetPreparerLocByClientid/:P_SPID/:P_CLIENTID')
|
||||||
GetPreparerLocByClientid(@Param() body: GetClientDTO) {
|
GetPreparerLocByClientid(@Param() body: GetClientDTO) {
|
||||||
return this.manageClientsService.GetPreparerLocByClientid(body);
|
return this.manageClientsService.GetPreparerLocByClientid(body);
|
||||||
|
|||||||
@ -10,6 +10,7 @@ import {
|
|||||||
ClientContactControlsDTO,
|
ClientContactControlsDTO,
|
||||||
CreateClientContactsDTO, CreateClientDataDTO,
|
CreateClientContactsDTO, CreateClientDataDTO,
|
||||||
CreateClientLocationsDTO,
|
CreateClientLocationsDTO,
|
||||||
|
GetClientContactByLacationIdDTO,
|
||||||
GetClientDTO,
|
GetClientDTO,
|
||||||
GetPreparersDTO, UpdateClientContactsDTO, UpdateClientDTO, UpdateClientLocationsDTO,
|
GetPreparersDTO, UpdateClientContactsDTO, UpdateClientDTO, UpdateClientLocationsDTO,
|
||||||
} from 'src/dto/property.dto';
|
} 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) => {
|
GetPreparerLocByClientid = async (body: GetClientDTO) => {
|
||||||
let connection;
|
let connection;
|
||||||
|
|
||||||
|
|||||||
@ -485,7 +485,7 @@ export class ManageHoldersService {
|
|||||||
throw new BadRequestException(fres[0].ERRORMESG)
|
throw new BadRequestException(fres[0].ERRORMESG)
|
||||||
}
|
}
|
||||||
|
|
||||||
return { statusCode: 200, message: 'Reactivated holder successfully' };
|
return { statusCode: 200, message: 'Inactivated holder successfully' };
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
handleError(error, ManageHoldersService.name)
|
handleError(error, ManageHoldersService.name)
|
||||||
} finally {
|
} finally {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user