modifications

main
josh 3 years ago
parent 31b755e904
commit 7cb0c9e694

@ -50,7 +50,7 @@ smsPhoneNumberArgName:
message: 'text' message: 'text'
url: url:
url: "https://tender.accuratesoftware.online/#" url: "https://www.thrickodithanamscb.in/#"
bodyWay2SMS: bodyWay2SMS:
apikey: "CKDG9HL5KYFLLILRMX3QX1CPKOIP8QF1" apikey: "CKDG9HL5KYFLLILRMX3QX1CPKOIP8QF1"
@ -81,8 +81,8 @@ payment-gateway:
failureRedirectUrlAcceptance: "/student/application" failureRedirectUrlAcceptance: "/student/application"
successRedirectUrlAcceptancePublic: "/auth/public/admission-form" successRedirectUrlAcceptancePublic: "/auth/public/admission-form"
failureRedirectUrlAcceptancePublic: "auth/public/admission-form" failureRedirectUrlAcceptancePublic: "auth/public/admission-form"
furl: "https://tenderapi.accuratesoftware.online/api/v1/payment-gateway/failure" furl: "https://tenderapi.simssoftware.in/api/v1/payment-gateway/failure"
surl: "https://tenderapi.accuratesoftware.online/api/v1/payment-gateway/success" surl: "https://tenderapi.simssoftware.in/api/v1/payment-gateway/success"
key : "MY3BX1lo" key : "MY3BX1lo"
salt : "9BISuuPeit" salt : "9BISuuPeit"
testing : true testing : true

37075
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -30,6 +30,7 @@
"@nestjs/schedule": "^1.0.1", "@nestjs/schedule": "^1.0.1",
"@nestjs/serve-static": "^4.0.0", "@nestjs/serve-static": "^4.0.0",
"@nestjs/typeorm": "^7.1.5", "@nestjs/typeorm": "^7.1.5",
"@types/nodemailer": "^6.4.9",
"@types/passport-facebook": "^2.1.11", "@types/passport-facebook": "^2.1.11",
"archiver": "^5.3.1", "archiver": "^5.3.1",
"bcrypt": "^5.0.0", "bcrypt": "^5.0.0",
@ -39,6 +40,8 @@
"crypto-js": "^4.0.0", "crypto-js": "^4.0.0",
"ifsc": "^2.0.11", "ifsc": "^2.0.11",
"js-sha512": "^0.8.0", "js-sha512": "^0.8.0",
"jspdf": "^2.3.1",
"jspdf-autotable": "^3.5.14",
"jwt-payload": "^1.0.7", "jwt-payload": "^1.0.7",
"node-oracledb": "^1.0.2", "node-oracledb": "^1.0.2",
"oracledb": "^5.1.0", "oracledb": "^5.1.0",
@ -56,6 +59,7 @@
"typeorm": "^0.2.31" "typeorm": "^0.2.31"
}, },
"devDependencies": { "devDependencies": {
"@nestjs-modules/mailer": "^1.8.1",
"@nestjs/cli": "^7.5.6", "@nestjs/cli": "^7.5.6",
"@nestjs/schematics": "^7.2.7", "@nestjs/schematics": "^7.2.7",
"@nestjs/testing": "^7.6.13", "@nestjs/testing": "^7.6.13",
@ -71,7 +75,7 @@
"eslint-config-prettier": "^8.1.0", "eslint-config-prettier": "^8.1.0",
"eslint-plugin-prettier": "^3.3.1", "eslint-plugin-prettier": "^3.3.1",
"jest": "^26.6.3", "jest": "^26.6.3",
"nodemailer": "^6.0.0", "nodemailer": "^6.9.3",
"otp-generator": "^2.0.0", "otp-generator": "^2.0.0",
"prettier": "^2.2.1", "prettier": "^2.2.1",
"supertest": "^6.1.3", "supertest": "^6.1.3",

@ -60,14 +60,10 @@ export class AuthService {
throw new BadRequestException('User Details not found') throw new BadRequestException('User Details not found')
} }
if (user) { if (user) {
// authCredentialsDto.secuLevel = user.secuLevel
return { username: user.userName, secuLevel: user.secuLevel, userId: user.userId, mobile: user.mobileNumber, email: user.email } return { username: user.userName, secuLevel: user.secuLevel, userId: user.userId, mobile: user.mobileNumber, email: user.email }
} }
} }
async signIn(authCredentialsDto: AuthCreadentialsDto, ip?: string): Promise<TokenDto> { async signIn(authCredentialsDto: AuthCreadentialsDto, ip?: string): Promise<TokenDto> {
const user: PcduserDto = await this.validateUserPassword(authCredentialsDto); const user: PcduserDto = await this.validateUserPassword(authCredentialsDto);
@ -93,7 +89,6 @@ export class AuthService {
} }
else { else {
throw new BadRequestException("Wrong Password"); throw new BadRequestException("Wrong Password");
} }
} }
@ -154,8 +149,8 @@ export class AuthService {
</tr> </tr>
<tr> <tr>
<td style="text-align:center;"> <td style="text-align:center;">
<a href="https://www.thrickodithanamscb.in/" title="logo" target="_blank"> <a href="https://www.thrickodithanamscb.in/" title="" target="_blank">
<img width="60" src="https://www.thrickodithanamscb.in/assets/img/emblemwithoutbg.png" title="logo" alt="logo"> <img width="60" src="https://www.thrickodithanamscb.in/assets/img/emblem3.png" title="logo" alt="logo">
</a> </a>
<h3 style="font-family: "Lucida Console", "Courier New", monospace;">THRICKODITHANAM SCB</h3> <h3 style="font-family: "Lucida Console", "Courier New", monospace;">THRICKODITHANAM SCB</h3>
</td> </td>
@ -220,15 +215,93 @@ export class AuthService {
} }
if (flag == 'uDocSub') { if (flag == 'uDocSub') {
content = `Dear ${custName},<br><br> content = `
We hope this email finds you well. We would like to express our sincere gratitude for your participation in the tender process for <a style="color:red;">${tenderName}</a>. We are pleased to inform you that your tender documents have been successfully submitted. Thank you for your meticulous efforts in preparing and submitting all the necessary documents within the specified timeframe.<br><br> <!doctype html>
<html lang="en-US">
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>OTP</title>
<meta name="description" content="New Account Email Template.">
<style type="text/css">
a:hover {text-decoration: underline !important;}
</style>
</head>
<body marginheight="0" topmargin="0" marginwidth="0" style="margin: 0px; background-color: #f2f3f8;" leftmargin="0">
<!-- 100% body table -->
<table cellspacing="0" border="0" cellpadding="0" width="100%" bgcolor="#f2f3f8"
style="@import url(https://fonts.googleapis.com/css?family=Rubik:300,400,500,700|Open+Sans:300,400,600,700); font-family: 'Open Sans', sans-serif;">
<tr>
<td>
<table style="background-color: #f2f3f8; max-width:800px; margin:0 auto;" width="100%" border="0"
align="center" cellpadding="0" cellspacing="0">
<tr>
<td style="height:80px;">&nbsp;</td>
</tr>
<tr>
<td style="text-align:center;">
<a href="https://www.thrickodithanamscb.in/" title="" target="_blank">
<img width="60" src="https://www.thrickodithanamscb.in/assets/img/emblem3.png" title="logo" alt="logo">
</a>
<h3 style="font-family: "Lucida Console", "Courier New", monospace;">THRICKODITHANAM SCB</h3>
</td>
</tr>
<tr>
<td style="height:20px;">&nbsp;</td>
</tr>
<tr>
<td>
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0"
style="max-width:670px; background:#fff; border-radius:3px; text-align:center;-webkit-box-shadow:0 6px 18px 0 rgba(0,0,0,.06);-moz-box-shadow:0 6px 18px 0 rgba(0,0,0,.06);box-shadow:0 6px 18px 0 rgba(0,0,0,.06);">
<tr>
<td style="height:40px;">&nbsp;</td>
</tr>
<tr>
<td style="padding:0 35px;">
<p style="font-size:15px; color:#455056; margin:8px 0 0; line-height:24px;">
Dear ${custName} , <br>
<strong> We hope this email finds you well. We would like to express our sincere gratitude for your participation in the tender process for <a style="color:red;">${tenderName}</a>. We are pleased to inform you that your tender documents have been successfully submitted.<br><br>
The bid opening for the tender you have participated in is scheduled for <a style="color:red;">${bidOpenDate}</a>. During this process, all submitted tenders will be carefully reviewed and assessed. We will diligently consider each proposal and evaluate it against the criteria outlined in the tender documentation.<br> The bid opening for the tender you have participated in is scheduled for <a style="color:red;">${bidOpenDate}</a>. During this process, all submitted tenders will be carefully reviewed and assessed. We will diligently consider each proposal and evaluate it against the criteria outlined in the tender documentation.<br>
Should any additional information or documents be required, we will promptly reach out to you via the contact details provided during the submission process.<br><br> Should any additional information or documents be required, we will promptly reach out to you via the contact details provided during the submission process.<br><br>
Should you have any queries or require any clarification regarding the tender process or your submission, please contact our dedicated tender support team. You can reach us via email at tscb178@gmail.com or by calling our helpline at tel:04812441062 or tel:04812443452.<br><br> Should you have any queries or require any clarification regarding the tender process or your submission, please contact our dedicated tender support team. You can reach us via email at tscb178@gmail.com or by calling our helpline at tel:04812441062 or tel:04812443452.<br><br>
Once again, we extend our heartfelt appreciation for your participation in this tender. Your interest and contribution are highly valued, and we look forward to the possibility of working together in the future.<br><br>
Best regards,<br> Best regards,<br>
Thrickodithanam Service Co-operative Bank LTD No 178,<br> Thrickodithanam Service Co-operative Bank LTD No 178,<br>
Kunnumpuram, Thrickodithanam,<br> Kottayam, Kerala, 686105.`; Kunnumpuram, Thrickodithanam,<br> Kottayam, Kerala, 686105.</strong>.</p>
<span
style="display:inline-block; vertical-align:middle; margin:29px 0 26px; border-bottom:1px solid #cecece; width:100px;"></span>
</td>
</tr>
<tr>
<td style="height:40px;">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr>
<td style="height:20px;">&nbsp;</td>
</tr>
<tr>
<td style="text-align:center;">
<p style="font-size:14px; color:rgba(69, 80, 86, 0.7411764705882353); line-height:18px; margin:0 0 0;">&copy;<strong> <a href="https://www.thrickodithanamscb.in/" >www.thrickodithanamscb.in</a></strong> </p>
</td>
</tr>
<tr>
<td style="height:80px;">&nbsp;</td>
</tr>
</table>
</td>
</tr>
</table>
<!--/100% body table-->
</body>
</html> `;
subject = 'Tender Submission Successful - Thank you for your participation!' subject = 'Tender Submission Successful - Thank you for your participation!'
} }
@ -258,8 +331,8 @@ export class AuthService {
</tr> </tr>
<tr> <tr>
<td style="text-align:center;"> <td style="text-align:center;">
<a href="https://www.thrickodithanamscb.in/" title="logo" target="_blank"> <a href="https://www.thrickodithanamscb.in/" title="" target="_blank">
<img width="60" src="https://www.thrickodithanamscb.in/assets/img/emblemwithoutbg.png" title="logo" alt="logo"> <img width="60" src="https://www.thrickodithanamscb.in/assets/img/emblem3.png" title="logo" alt="logo">
</a> </a>
<h3 style="font-family: "Lucida Console", "Courier New", monospace;">THRICKODITHANAM SCB</h3> <h3 style="font-family: "Lucida Console", "Courier New", monospace;">THRICKODITHANAM SCB</h3>
</td> </td>

@ -57,4 +57,6 @@ export class TenderDetailDto{
formOfContract: number; formOfContract: number;
emdFeeType: string; emdFeeType: string;
activeYn: string; activeYn: string;
sendReport : string;
bidOpenAddress : string
} }

@ -1,4 +1,4 @@
import { Controller, Get, Post, Body } from '@nestjs/common'; import { Controller, Get, Post, Body, Param } from '@nestjs/common';
import { EmailService } from './email.service'; import { EmailService } from './email.service';
@Controller('email') @Controller('email')
@ -8,6 +8,13 @@ export class EmailController {
private service: EmailService private service: EmailService
) { } ) { }
@Get('report/:id')
sendReport(
@Param('id') id:string
){
return this.service.pdfReport(id)
}
// @Post() // @Post()
// sendMail(@Body() body){ // sendMail(@Body() body){
// console.log("===here===") // console.log("===here===")

@ -3,6 +3,10 @@ import { EmailController } from './email.controller';
import { EmailService } from './email.service'; import { EmailService } from './email.service';
import { HandlebarsAdapter, MailerModule } from '@nest-modules/mailer'; import { HandlebarsAdapter, MailerModule } from '@nest-modules/mailer';
import * as config from 'config'; import * as config from 'config';
import { TenderMasterRepository } from 'src/tables/tender-master/tender-master.repository';
import { TypeOrmModule } from '@nestjs/typeorm';
import { tenderDocRepository } from 'src/tables/tender-documents/tender-doc.repository';
import { PaymentMasterRepository } from 'src/tables/payment-master/payment-master.repository';
const emailConfig = config.get('mail'); const emailConfig = config.get('mail');
@ -24,9 +28,10 @@ const emailConfig = config.get('mail');
}), }),
}), }),
TypeOrmModule.forFeature([TenderMasterRepository,PaymentMasterRepository]),
], ],
controllers: [EmailController], controllers: [EmailController],
providers: [EmailService,], providers: [EmailService],
exports: [ exports: [
MailerModule, MailerModule,
EmailService EmailService

@ -1,19 +1,149 @@
import { Injectable } from '@nestjs/common'; import { Injectable ,NotFoundException} from '@nestjs/common';
import { MailerService } from '@nest-modules/mailer'; import { MailerService } from '@nest-modules/mailer';
import * as config from 'config'; import * as config from 'config';
import { TenderMasterRepository } from 'src/tables/tender-master/tender-master.repository';
import { PaymentMasterRepository } from 'src/tables/payment-master/payment-master.repository';
import { log } from 'console';
import * as nodemailer from 'nodemailer';
import { createFolders } from 'src/file-upload/file-upload.controller';
const mail= config.get('mail'); const mail= config.get('mail');
import jsPDF from 'jspdf';
import autoTable from 'jspdf-autotable';
import { promisify } from 'util';
@Injectable() @Injectable()
export class EmailService { export class EmailService {
reportArray: any;
constructor( constructor(
private readonly mailerService: MailerService private readonly mailerService: MailerService,
private tenderMasterRepository : TenderMasterRepository,
private paymentMasterRepository : PaymentMasterRepository
) { } ) { }
// documenation : https://www.npmjs.com/package/@nest-modules/mailer // documenation : https://www.npmjs.com/package/@nest-modules/mailer
async pdfReport(id){
let query= `SELECT tm.id , tm.title ,tm.send_report,tm.bid_open_date FROM tender_master tm WHERE tm.id = ${id}
`
let reportNotSend =await this.tenderMasterRepository.query(query)
let query1= `SELECT "PaymentMaster"."id" AS "id",
"PaymentMaster"."user_id" AS "userId",
tm.tender_id AS "tenderId",
"PaymentMaster"."trans_id" AS "transId",
"PaymentMaster"."final_bid_amt" AS "finalBidAmt",
"PaymentMaster_pcduserD"."user_name" AS "userName",
"PaymentMaster_pcduserD"."email" AS "email",
"PaymentMaster_pcduserD"."mobile_number" AS "mobileNumber"
FROM "payment-master" "PaymentMaster"
LEFT JOIN "pcduser" "PaymentMaster_pcduserD" ON"PaymentMaster_pcduserD"."user_id"="PaymentMaster"."user_id"
LEFT join "tender_master" "tm" on "tm"."id" = "PaymentMaster"."tender_id"
WHERE "PaymentMaster"."tender_id" = ${id}
and "PaymentMaster"."status"= 'S'
AND "PaymentMaster"."final_bid_amt" IS NOT NULL;`
let report =await this.paymentMasterRepository.query(query1);
if(report.length == 0){
throw new NotFoundException('Document entry not found.');
}
return this.generateReport(report,id)
}
async generateReport(report,id) {
const enq = await report;
const doc = new jsPDF('landscape');
let headers = (['id', 'userId', 'tenderId', 'transId', 'finalBidAmt', 'userName', 'email', 'mobileNumber']);
// Prepare the data in the required format for autoTable
let data = [];
enq.forEach((item) => {
data.push([
item.id,
item.userId,
item.tenderId,
item.transId,
item.finalBidAmt,
item.userName,
item.email,
item.mobileNumber
]);
});
// Create the table in the PDF document
autoTable(doc,{
startY: 1, // Adjust the starting position of the table (Y coordinate)
head: [headers],
body: data,
});
// Save the PDF
const filePath: string = './uploads/Report';
createFolders(filePath);
doc.save(`${filePath}/${id}.pdf`);
console.log(id);
const pdfFileName = `${id}.pdf`;
const filePathReport: string = './uploads/Report/';
// Update pdfStatus
let pdfStatus =await this.tenderMasterRepository.findOne({where:{id:id}});
pdfStatus.sendReport = 'Y'
this.tenderMasterRepository.save(pdfStatus)
// Send email with attachment
const transporter = nodemailer.createTransport({
host: 'smtp.gmail.com',
port: 465,
secure: true,
auth: {
user: 'website.tscb@gmail.com',
pass: 'zubhybaneozurlvy',
},
tls: {
rejectUnauthorized: false,
},
});
const mailOptions = {
from: 'tender.tscb178@gmail.com',
to: 'tender.tscb178@gmail.com',
subject: `Generated PDF Report for ID: ${report[0].tenderId}`,
text: 'Attached PDF report.',
attachments: [
{
filename: pdfFileName,
path: `${filePathReport}${pdfFileName}`,
},
],
};
const sendMail = promisify(transporter.sendMail.bind(transporter));
try {
await sendMail(mailOptions);
console.log('Email sent successfully');
return {data : "Email sent successfully"}
} catch (error) {
console.error('Error sending email:', error);
return {data : "Error sending email:", error}
}
}
async sendMail(toMail:string,subject:string,bodyText: string,htmlText:string){ async sendMail(toMail:string,subject:string,bodyText: string,htmlText:string){
this.mailerService.sendMail({ this.mailerService.sendMail({
to: toMail, // sender addressject: subject, // Subject line to: toMail, // sender address
subject: subject, // Subject line
text: bodyText, // plaintext body text: bodyText, // plaintext body
html: htmlText, // HTML body content html: htmlText, // HTML body content
}) })

@ -139,8 +139,8 @@ export class FileUploadController {
console.log("deleted=====",id,filename); console.log("deleted=====",id,filename);
await fs.promises.unlink(filePath); await fs.promises.unlink(filePath);
const filter = { docName: filename }; const filter = { docName: filename ,id:id };
const deletedEntry = await this.tenderDocRepository.findOne(filter); const deletedEntry = await this.tenderDocRepository.findOne({where:{ docName: filename ,tenderId:id , documentCategory:'D'}});
if (deletedEntry) { if (deletedEntry) {
console.log('helloooooo'); console.log('helloooooo');
await this.tenderDocRepository.remove(deletedEntry); await this.tenderDocRepository.remove(deletedEntry);
@ -166,7 +166,7 @@ async deleteUserDoc(
await fs.promises.unlink(filePath); await fs.promises.unlink(filePath);
const filter = { docName: filename }; const filter = { docName: filename };
const deletedEntry = await this.tenderDocRepository.findOne(filter); const deletedEntry = await this.tenderDocRepository.findOne({where:{docName : filename , tenderId:id ,userId:userId,documentCategory:'USERD'}});
if (deletedEntry) { if (deletedEntry) {
console.log('helloooooo'); console.log('helloooooo');
await this.tenderDocRepository.remove(deletedEntry); await this.tenderDocRepository.remove(deletedEntry);
@ -190,7 +190,7 @@ async deleteBankDoc(
await fs.promises.unlink(filePath); await fs.promises.unlink(filePath);
const filter = { docName: filename }; const filter = { docName: filename };
const deletedEntry = await this.tenderDocRepository.findOne(filter); const deletedEntry = await this.tenderDocRepository.findOne({where:{docName: filename , tenderId:id , documentCategory:'WID'}});
if (deletedEntry) { if (deletedEntry) {
console.log('helloooooo'); console.log('helloooooo');
await this.tenderDocRepository.remove(deletedEntry); await this.tenderDocRepository.remove(deletedEntry);
@ -215,7 +215,7 @@ async deleteNotice(
await fs.promises.unlink(filePath); await fs.promises.unlink(filePath);
const filter = { docName: filename }; const filter = { docName: filename };
const deletedEntry = await this.tenderDocRepository.findOne(filter); const deletedEntry = await this.tenderDocRepository.findOne({where:{docName: filename , tenderId:id ,documentCategory:'NIT'}});
if (deletedEntry) { if (deletedEntry) {
console.log('helloooooo'); console.log('helloooooo');
await this.tenderDocRepository.remove(deletedEntry); await this.tenderDocRepository.remove(deletedEntry);

@ -3,13 +3,14 @@ import { PcduserDto } from 'src/auth/dto/pcd-user.dto';
import { FindManyOptions, Not, Repository } from 'typeorm'; import { FindManyOptions, Not, Repository } from 'typeorm';
import { PcdFormGridInterface } from '../interface/pcd-form-grid.interface'; import { PcdFormGridInterface } from '../interface/pcd-form-grid.interface';
import * as config from 'config' import * as config from 'config'
import { log } from 'console';
const oracledb = require('oracledb'); const oracledb = require('oracledb');
const dbConfig = config.get('db'); const dbConfig = config.get('db');
export class PcdFormGridService<T> implements PcdFormGridInterface { export class PcdFormGridService<T> implements PcdFormGridInterface {
MAIN_KEY: string = 'id'; MAIN_KEY: string = 'id';
CUSTID: string = 'custId'; CUSTID: string = '';
MANDATORY_FEILDS: string[] = []; MANDATORY_FEILDS: string[] = [];
DUPLICATE_CHK: string[] = []; DUPLICATE_CHK: string[] = [];
FK_FEILDS: { column: string, relation: Repository<any> }[] = []; FK_FEILDS: { column: string, relation: Repository<any> }[] = [];
@ -94,10 +95,10 @@ export class PcdFormGridService<T> implements PcdFormGridInterface {
} }
console.log("==user.userId==", user); console.log("==user.userId==", user);
if (user && user.custId) { if (user ) {
body["createdBy"] = user.userId; body["createdBy"] = user.userId;
body["modifiedBy"] = user.userId; body["modifiedBy"] = user.userId;
body[this.CUSTID] = user.custId; // body[this.CUSTID] = user.custId;
} }
if (!await this.preCreateOne(body, user)) if (!await this.preCreateOne(body, user))
@ -124,6 +125,10 @@ export class PcdFormGridService<T> implements PcdFormGridInterface {
} }
async updateOne(body: any, id: string | number, user: PcduserDto): Promise<any> { async updateOne(body: any, id: string | number, user: PcduserDto): Promise<any> {
console.log("====user====", user); console.log("====user====", user);
console.log(id);
console.log(body);
for (let colMan of this.MANDATORY_FEILDS) { for (let colMan of this.MANDATORY_FEILDS) {
if (!body[colMan] || body[colMan].toString().trim() == "") { if (!body[colMan] || body[colMan].toString().trim() == "") {

@ -3,7 +3,7 @@ import { PaymentMasterDto } from 'src/dto/payment-master.dto';
import { PcdFormGridController } from 'src/framework/beans/pcd-form-grid.controller'; import { PcdFormGridController } from 'src/framework/beans/pcd-form-grid.controller';
import { PaymentMasterService } from './payment-master.service'; import { PaymentMasterService } from './payment-master.service';
import { AuthGuard } from '@nestjs/passport'; import { AuthGuard } from '@nestjs/passport';
@UseGuards(AuthGuard()) //@UseGuards(AuthGuard())
@Controller('payment-master') @Controller('payment-master')
export class PaymentMasterController extends PcdFormGridController<PaymentMasterDto> { export class PaymentMasterController extends PcdFormGridController<PaymentMasterDto> {
@ -17,7 +17,7 @@ export class PaymentMasterController extends PcdFormGridController<PaymentMaster
@Get('bid-report/:id') @Get('bid-report/:id')
async bidReport( async bidReport(
@Param('id') tenderId: string @Param('id') tenderId: string
):Promise<void>{ ){
return this.paymentMasterService.bidReport(tenderId) return this.paymentMasterService.bidReport(tenderId)
} }
@ -27,8 +27,6 @@ export class PaymentMasterController extends PcdFormGridController<PaymentMaster
@Param('userId') userId: string, @Param('userId') userId: string,
@Param('tenderId') tenderId : string @Param('tenderId') tenderId : string
){ ){
return this.paymentMasterService.bidPaymentCheck(tenderId ,userId) return this.paymentMasterService.bidPaymentCheck(tenderId ,userId)
} }
@ -41,4 +39,29 @@ export class PaymentMasterController extends PcdFormGridController<PaymentMaster
return this.paymentMasterService.finalBidAmt(tenderId ,userId , body) return this.paymentMasterService.finalBidAmt(tenderId ,userId , body)
} }
@Post('paymentInfo')
async paymentInfo(
@Body() paymentMasterDto : PaymentMasterDto
){
return this.paymentMasterService.paymentInfo(paymentMasterDto)
}
@Get('userBidPaymentCheck/:userId/:tenderId')
async userBidPaymentCheck(
@Param('userId') userId: string,
@Param('tenderId') tenderId : string
){
return this.paymentMasterService.userBidPaymentCheck(tenderId ,userId)
}
@Post('updatePaymentStatus/:userId/:tenderId')
async AdminUpdatePaymentStatus(
@Param('userId') userId: string,
@Param('tenderId') tenderId : string,
@Body() body: { status : string },
){
return this.paymentMasterService.AdminUpdatePaymentStatus(userId,tenderId,body)
}
} }

@ -1,8 +1,10 @@
import { Injectable ,BadRequestException} from '@nestjs/common'; import { Injectable ,BadRequestException,NotFoundException} from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { PaymentMasterDto } from 'src/dto/payment-master.dto'; import { PaymentMasterDto } from 'src/dto/payment-master.dto';
import { PcdFormGridService } from 'src/framework/beans/pcd-form-grid.service'; import { PcdFormGridService } from 'src/framework/beans/pcd-form-grid.service';
import { PaymentMasterRepository } from './payment-master.repository'; import { PaymentMasterRepository } from './payment-master.repository';
import { response } from 'express';
import { log } from 'console';
@Injectable() @Injectable()
@ -17,7 +19,6 @@ export class PaymentMasterService extends PcdFormGridService<PaymentMasterDto>{
async bidReport(tenderId){ async bidReport(tenderId){
let id = tenderId.toString() let id = tenderId.toString()
console.log(id);
let query= `SELECT "PaymentMaster"."id" AS "id", let query= `SELECT "PaymentMaster"."id" AS "id",
"PaymentMaster"."user_id" AS "userId", "PaymentMaster"."tender_id" AS "tenderId", "PaymentMaster"."user_id" AS "userId", "PaymentMaster"."tender_id" AS "tenderId",
@ -28,7 +29,8 @@ async bidReport(tenderId){
"PaymentMaster_pcduserD"."mobile_number" AS "mobileNumber" FROM "payment-master" "PaymentMaster" LEFT JOIN "pcduser" "PaymentMaster_pcduserD" ON "PaymentMaster_pcduserD"."mobile_number" AS "mobileNumber" FROM "payment-master" "PaymentMaster" LEFT JOIN "pcduser" "PaymentMaster_pcduserD" ON
"PaymentMaster_pcduserD"."user_id"="PaymentMaster"."user_id" WHERE "PaymentMaster"."tender_id"= ${id}` "PaymentMaster_pcduserD"."user_id"="PaymentMaster"."user_id" WHERE "PaymentMaster"."tender_id"= ${id}`
let report =await this.paymentMasterRepository.query(query) let report =await this.paymentMasterRepository.query(query)
return report; let countStatusP = report.filter(item => item.status === 'P').length;
return { report, countStatusP };
} }
@ -60,5 +62,47 @@ async finalBidAmt(tenderId ,userId,body){
} }
} }
async paymentInfo(paymentMasterDto) {
try {
console.log(paymentMasterDto);
const res = await this.paymentMasterRepository.save(paymentMasterDto);
return { data: "Payment Saved Successfully" };
} catch (err) {
return { data: "Error while saving data" };
}
}
async userBidPaymentCheck(tenderId,userId){
let query= `SELECT "PaymentMaster"."id" AS "id",
"PaymentMaster"."user_id" AS "userId", "PaymentMaster"."tender_id" AS "tenderId",
"PaymentMaster"."trans_id" AS "transId", "PaymentMaster"."status" AS "status",
"PaymentMaster_pcduserD"."user_name" AS "userName",
"PaymentMaster_pcduserD"."email" AS "email",
"PaymentMaster_pcduserD"."mobile_number" AS "mobileNumber" FROM "payment-master" "PaymentMaster" LEFT JOIN "pcduser" "PaymentMaster_pcduserD" ON
"PaymentMaster_pcduserD"."user_id"="PaymentMaster"."user_id" WHERE "PaymentMaster"."tender_id"= ${tenderId} and "PaymentMaster"."user_id"= '${userId}'`
let report =await this.paymentMasterRepository.query(query)
if(report.length === 0){
throw new NotFoundException("User Payment Not Found")
}
return report;
}
async AdminUpdatePaymentStatus(userId , tenderId , body){
try{
let user =await this.paymentMasterRepository.findOne({userId:userId , tenderId:tenderId})
console.log(user);
user.status = body.status;
let result = await this.paymentMasterRepository.save(user);
return {data: "Payment Status Updated Successfully" }
}catch(err){
return {data: "Error in Payment Status Updation" }
}
}
} }

@ -1,4 +1,4 @@
import { Controller ,UseGuards} from '@nestjs/common'; import { Controller ,UseGuards,Get,Param,Post} from '@nestjs/common';
import { TenderDocumentDto } from 'src/dto/tender-document.dto'; import { TenderDocumentDto } from 'src/dto/tender-document.dto';
import { PcdFormGridController } from 'src/framework/beans/pcd-form-grid.controller'; import { PcdFormGridController } from 'src/framework/beans/pcd-form-grid.controller';
import { TenderDocService } from './tender-doc.service'; import { TenderDocService } from './tender-doc.service';
@ -14,4 +14,13 @@ export class TenderDocController extends PcdFormGridController<TenderDocumentDto
super(tenderDocService); super(tenderDocService);
} }
@Get("userDocCheck/:userId/:tenderId")
async userDocCheck(
@Param('userId') userId:string,
@Param('tenderId') tenderId : string
){
return this.tenderDocService.userDocCheck(userId,tenderId)
}
} }

@ -1,8 +1,9 @@
import { Injectable } from '@nestjs/common'; import { Injectable ,BadRequestException} from '@nestjs/common';
import { PcdFormGridService } from 'src/framework/beans/pcd-form-grid.service'; import { PcdFormGridService } from 'src/framework/beans/pcd-form-grid.service';
import { tenderDocRepository } from './tender-doc.repository'; import { tenderDocRepository } from './tender-doc.repository';
import { InjectRepository } from '@nestjs/typeorm'; import { InjectRepository } from '@nestjs/typeorm';
import { TenderDocumentDto } from 'src/dto/tender-document.dto'; import { TenderDocumentDto } from 'src/dto/tender-document.dto';
import { log } from 'console';
@Injectable() @Injectable()
export class TenderDocService extends PcdFormGridService<TenderDocumentDto>{ export class TenderDocService extends PcdFormGridService<TenderDocumentDto>{
@ -14,4 +15,11 @@ export class TenderDocService extends PcdFormGridService<TenderDocumentDto>{
super(tenderDocRepository); super(tenderDocRepository);
} }
async userDocCheck(userId,tenderId){
let query = `select * from "tender-doc" td where td.user_id = '${userId}' and td.tender_id ='${tenderId}' and doc_category ='USERD' `
let userDoc =await this.tenderDocRepository.query(query)
return userDoc
}
} }

@ -358,6 +358,21 @@ export class TenderMaster extends PcdBaseEntity {
}) })
activeYn: string activeYn: string
@Column({
name:"send_report",
type:"varchar",
length:1,
nullable:true
})
sendReport:string
@Column({
name:"bid_open_address",
type:"varchar",
nullable:true
})
bidOpenAddress:string
@OneToMany(() => CoverDoc, (coverDoc) => coverDoc.tenderIdD) @OneToMany(() => CoverDoc, (coverDoc) => coverDoc.tenderIdD)
coverDoc: CoverDoc[] coverDoc: CoverDoc[]

@ -1,9 +1,11 @@
import { Body, Controller, Get, UseGuards } from '@nestjs/common'; import { Body, Controller, Get, UseGuards,Query } from '@nestjs/common';
import { TenderDetailDto } from 'src/dto/tender-master.dto'; import { TenderDetailDto } from 'src/dto/tender-master.dto';
import { PcdTransactionController } from 'src/framework/beans/pcd-transaction.controller'; import { PcdTransactionController } from 'src/framework/beans/pcd-transaction.controller';
import { TenderService } from './tender.service'; import { TenderService } from './tender.service';
import { AuthGuard } from '@nestjs/passport'; import { AuthGuard } from '@nestjs/passport';
import { FindManyOptions } from 'typeorm';
@Controller('tender') @Controller('tender')
export class TenderController extends PcdTransactionController<TenderDetailDto> { export class TenderController extends PcdTransactionController<TenderDetailDto> {
@ -14,9 +16,11 @@ export class TenderController extends PcdTransactionController<TenderDetailDto>
} }
@Get('admin') @Get('admin')
async getTender() { async getTender(
@Query() filter: FindManyOptions,
) {
return this.tenderService.GetAdminTenderD() return this.tenderService.GetAdminTenderD(filter)
} }
@Get('admin/dashboard') @Get('admin/dashboard')
async getDashboard() { async getDashboard() {

@ -50,12 +50,14 @@ export class TenderService extends PcdTransactionService<TenderDetailDto>{
return true return true
} }
async GetAdminTenderD() { async GetAdminTenderD(
return this.tenderMasterRepository.find() filter:FindManyOptions
) {
return this.tenderMasterRepository.find(filter)
} }
async GetAdminDashboard(){ async GetAdminDashboard(){
let query = `select id, title , bid_open_date as bidOpenDate, publish_date as publishDate from tender_master tm ` let query = `select id, title , bid_open_date as bidOpenDate, publish_date as publishDate from tender_master tm order by id desc`
return this.tenderMasterRepository.query(query) return this.tenderMasterRepository.query(query)
} }
} }

Loading…
Cancel
Save