modifications

main
josh 3 years ago
parent 7ab4ce15be
commit 20f1d829ea

@ -1,5 +1,5 @@
server:
port: 3300
port: 3500
db:
type: 'postgres'
port: '5432'

1491
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -28,8 +28,10 @@
"@nestjs/passport": "^7.1.6",
"@nestjs/platform-express": "^7.6.13",
"@nestjs/schedule": "^1.0.1",
"@nestjs/serve-static": "^4.0.0",
"@nestjs/typeorm": "^7.1.5",
"@types/passport-facebook": "^2.1.11",
"archiver": "^5.3.1",
"bcrypt": "^5.0.0",
"class-transformer": "^0.4.0",
"class-validator": "^0.13.1",

@ -5,13 +5,16 @@ import { typeOrmConfig } from './config/typeorm.config';
import { AuthModule } from './auth/auth.module';
import { FileUploadModule } from './file-upload/file-upload.module';
import { ScheduleModule } from '@nestjs/schedule';
import { TenderDetailsModule } from './tender-master/tender-details.module';
import { TenderDetailsModule } from './tables/tender-master/tender-details.module';
import { FormOfContractModule } from './tables/form-of-contract/form-of-contract.module';
import { PaymentModeModule } from './tables/payment-mode/payment-mode.module';
import { TenderTypeModule } from './tables/tender-type/tender-type.module';
import { ProductCategoryModule } from './tables/product-category/product-category.module';
import { TenderCategoryModule } from './tables/tender-category/tender-category.module';
import { EmdFeeTypeModule } from './tables/emd-fee-type/emd-fee-type.module';
import { TenderModule } from './transactions/tender/tender.module';
import { TenderDocModule } from './tables/tender-documents/tender-doc.module';
import { DocumentTypeModule } from './tables/document-type/document-type.module';
@ -29,6 +32,10 @@ import { EmdFeeTypeModule } from './tables/emd-fee-type/emd-fee-type.module';
ProductCategoryModule,
TenderCategoryModule,
EmdFeeTypeModule,
TenderModule,
TenderDocModule,
DocumentTypeModule,
],
})

@ -48,22 +48,18 @@ export class AuthController {
// @Post('/signup')
// async signUp(@Body(ValidationPipe) signUp: TempSignUpDto): Promise<any> {
// // request.connection.remoteAddress
// console.log("hello");
@Post('/signup')
async signUp(@Body() pcdUserDto: PcduserDto): Promise<any> {
// request.connection.remoteAddress
console.log("hello");
// return this.authService.tempSignUp(signUp);
// }
return this.authService.tempSignUp(pcdUserDto);
}
@Post('/forgot-password')
async forgotPassword(
@Body() body: { pass: string, mobNo: string },
@Body() body: { pass: string, email: string ,otp:string },
): Promise<any> {
console.log("mobile",body.mobNo);
return await this.authService.forgotPassword(body);
}

@ -9,7 +9,7 @@ import { AuthCreadentialsDto } from './dto/auth-credentials.dto';
import { TokenDto } from './dto/token.dto';
import { JwtPayload } from './jwt-payload.interface';
import { PcduserDto } from 'src/auth/dto/pcd-user.dto';
import { Connection, createConnection, FindManyOptions, getConnection, getCustomRepository, In, IsNull, Not, QueryRunner } from 'typeorm';
import { Connection, createConnection, FindManyOptions, getConnection, getCustomRepository, In, IsNull, Like, Not, QueryRunner } from 'typeorm';
import { TempSignUpDto } from './dto/temp-sign-up.dto';
import { PcduserRepository } from './pcduser.repository';
import { InjectRepository } from '@nestjs/typeorm';
@ -54,13 +54,14 @@ export class AuthService {
}
async userInfo(authCredentialsDto: AuthCreadentialsDto){
const { username } = authCredentialsDto;
let user = await this.pcduserRepository.findOne({ mobileNumber: (username.trim()).toLocaleLowerCase() });
const { username ,secuLevel } = authCredentialsDto;
let user = await this.pcduserRepository.findOne({ email: (username.trim()).toLocaleLowerCase() });
if(!user){
throw new BadRequestException('User Details not found')
}
if(user){
return {username:user.userName}
// authCredentialsDto.secuLevel = user.secuLevel
return {username:user.userName ,secuLevel:user.secuLevel}
}
@ -81,7 +82,7 @@ export class AuthService {
async validateUserPassword(authCredentialsDto: AuthCreadentialsDto): Promise<Pcduser> {
const { username, password} = authCredentialsDto;
let user = await this.pcduserRepository.findOne({ mobileNumber: (username.trim()).toLocaleLowerCase() });
let user = await this.pcduserRepository.findOne({ email: (username.trim()).toLocaleLowerCase() });
console.log("user=============", user);
if (!user) {
throw new UnauthorizedException('User not Registered')
@ -96,26 +97,34 @@ export class AuthService {
}
}
async forgotPassword(body: { pass: string, mobNo: string, }): Promise<any> {
let iuserData: PcduserDto = await this.pcduserRepository.findOne({ where: { mobileNumber: body.mobNo } });
console.log("iuserdata", iuserData.deviceId);
async forgotPassword(body: { pass: string, email: string, otp:string }): Promise<any> {
let iuserData: PcduserDto = await this.pcduserRepository.findOne({ where: { email: body.email } });
console.log("iuserdata",iuserData);
const filter: FindManyOptions = { where: { "refCode": body.email, "status": "I" }, order: { code: "DESC" } };
const newOtp = await this.pcdotpRepository.find(filter);
if(body.otp != newOtp[0].otp){
throw new UnauthorizedException('Unauthorized Access')
}
const salt = await bcrypt.genSalt();
iuserData.salt = salt;
iuserData.pass = await this.pcduserRepository.encryptPassword(body.pass, salt);
iuserData.pass = await bcrypt.hash(body.pass, salt);
console.log("salt",iuserData.salt);
console.log("pass",iuserData.pass);
try {
await this.pcduserRepository.save(iuserData);
}
catch (err) {
throw new BadRequestException("Error in Password creation");
throw new BadRequestException("Error in Password Reset");
}
}
async sendMail(email: string, data: string, flag: string) {
let content: string;
let subject: string = "Login Credentials";
if (flag == 'otp') {
@ -123,16 +132,14 @@ export class AuthService {
subject = 'OTP'
}
// if (flag == 'pwd') {
// content = `Your New Password for Accurate Application Registration is, ${data}`;
// subject = 'New Password'
// }
// if (flag == 'fpwd') {
// content = `Your one time password(OTP) for Password reset is, ${data}`;
// subject = 'OTP'
// }
if (flag == 'fpwd') {
content = `Your one time password(OTP) for Password reset is, ${data}`;
subject = 'OTP'
}
await this.mailService.sendMail(email, subject, content, content);
}
@ -146,16 +153,20 @@ export class AuthService {
console.log("isUserExist",isUserExist);
if(!isUserExist){
throw new BadRequestException("User not found");
}
if (flag == 'R' && isUserExist) {
throw new BadRequestException("Already registered with this email Id.");
}else{
let newOtp = await this.generateOtp(body.email, flag);
if (body.email && flag == 'R') {
await this.sendMail(body.email, newOtp, 'otp');
}
if (body.email && flag == 'F') {
await this.sendMail(body.email, newOtp, 'fpwd');
}
}
} err => {
@ -165,22 +176,45 @@ export class AuthService {
}
}
// async duplicateCheckingEmail(email: string, flag: string, filter?: FindManyOptions): Promise<any> {
async tempSignUp(pcdUserDto: PcduserDto): Promise<any> {
const filter: FindManyOptions = { where: { "refCode": pcdUserDto.email, "status": "I" }, order: { code: "DESC" } };
const newOtp = await this.pcdotpRepository.find(filter);
const existingUser = await this.pcduserRepository.findOne({ where: { email: pcdUserDto.email } });
if (existingUser) {
throw new BadRequestException('User Already Exists');
}
if (pcdUserDto.otp != newOtp[0].otp) {
throw new UnauthorizedException('Unauthorized Access');
}
// const isUserExist = await this.pcduserRepository.findOne({ where: { email: email } });
// if (isUserExist && flag == 'F')
// return isUserExist;
// if (isUserExist && flag == 'R')
// return isUserExist;
// else if (isUserExist && flag == 'P')
// throw new BadRequestException(`Already registered with this email Id - ${isUserExist.email}`);
//Creating Random User_Id for every user registered
const lastUser: PcduserDto = await this.pcduserRepository.findOne({
where: {},
order: { userId: 'DESC' },
});
let maxCode = 10000;
if (lastUser && lastUser.userId) {
const lastUserId = parseInt(lastUser.userId);
maxCode = Math.max(maxCode, lastUserId);
}
const newUserId = String(maxCode + 1).padStart(5, '0');
/////////////////////////////////////////////////////////////
pcdUserDto.userId = newUserId;
const salt = await bcrypt.genSalt();
pcdUserDto.salt = salt;
pcdUserDto.pass = await bcrypt.hash(pcdUserDto.pass, salt);
pcdUserDto.secuLevel = 'U';
delete pcdUserDto['otp'];
await this.pcduserRepository.save(pcdUserDto);
this.logger.verbose("User created with email:", pcdUserDto.email);
return { data: "Successfully Registered" };
}
// }
async verifyOtp(body: { otp: string, email: string }, flag: string): Promise<any> {
@ -272,77 +306,7 @@ export class AuthService {
}
// async updateUser(body: PcduserDto, user: PcduserDto, id: string): Promise<PcduserDto> {
// const updatedUser = await this.pcduserRepository.findOne(id);
// if (updatedUser) {
// await this.duplicateCheckingUser(body, 'U');
// updatedUser.userName = body.userName;
// // updatedUser.email = body.email;
// updatedUser.mobileNumber = body.mobileNumber;
// updatedUser.modifiedBy = user.userId;
// updatedUser.userImagePath = body.userImagePath;
// updatedUser.memberNo = body.memberNo;
// for (let eagerCol of await this.pcduserRepository.getEagerColumns()) {
// delete body[eagerCol];
// }
// try {
// delete updatedUser["pass"];
// delete updatedUser["salt"];
// delete updatedUser["refreshtoken"];
// return await this.pcduserRepository.save(updatedUser);
// } catch (error) {
// console.log("====error====", error);
// throw new BadRequestException(error.message);
// }
// }
// else
// throw new BadRequestException("User does not Exist");
// }
// async duplicateCheckingUser(body: PcduserDto, flag: string): Promise<void> {
// let existingUser: PcduserDto;
// if (flag == 'I') {
// let existingIgUser: PcduserDto = await this.pcduserRepository.findOne({ where: { email: body.email } });
// if (existingIgUser)
// throw new BadRequestException(`User with same Email exist`);
// existingUser = await this.pcduserRepository.findOne({ where: [{ "userId": body.userId }, { "email": body.email }, { "mobileNumber": body.mobileNumber }] });
// }
// else {
// existingUser = await this.pcduserRepository.findOne({ where: [{ "userId": (body.userId), "email": body.email }, { "userId": Not(body.userId), "mobileNumber": body.mobileNumber }] });
// }
// if (existingUser) {
// if (flag == 'I' && existingUser.userId == body.userId)
// throw new BadRequestException(`Duplication in UserId ${body.userId}`);
// if (existingUser.email == body.email)
// throw new BadRequestException(`Duplication in Email ${body.email}`);
// }
// }
// async googleSignIn(mediaData: any, ip?: string): Promise<TokenDto> {
// const iuser: IuserDto = await this.iuserRepository.findOne({ email: mediaData.email });
// if (!iuser) {
// throw new UnauthorizedException('User Not registered..');
// }
// return await this.generateTokens(iuser, iuser.userName, ip, ""); //specify the module here
// }
// async getVersion(): Promise<{ versionNo: string }> {
// const result = { versionNo: config.get('version').versionNo };
// return result;
// }
// async createConnection(bankcode: string) {
// return await connectOraDatabase(bankcode);
// }
// async closeConnection(connection) {
// await closeOraConnection(connection);
// }
/* The below method is used for generating the access token and refresh token when login */
async generateTokens(user: PcduserDto, username: string, ip: string, module: string, changePassword?: string): Promise<TokenDto> {
@ -359,150 +323,10 @@ export class AuthService {
return result;
}
// async changePasswordManual(newPassword: ChangePasswordDto, id: string, user: PcduserDto, type?): Promise<{ msg: string, status: string }> {
// let salt = await bcrypt.genSalt();
// const selectedUser = await this.pcduserRepository.findOne(id);
// console.log('newPassword=====', newPassword);
// console.log('type=====', type);
// if (!newPassword || !newPassword.pass || !newPassword.pass.toString())
// throw new BadRequestException("Password can't be null");
// if (type == 'T') {
// selectedUser.tSalt = salt;
// selectedUser.tPass = await this.hashPassword(newPassword.pass, salt);
// } else if (type == 'A') {
// selectedUser.tSalt = salt;
// selectedUser.tPass = await this.hashPassword(newPassword.tpass, salt);
// salt = await bcrypt.genSalt();
// selectedUser.salt = salt;
// selectedUser.pass = await this.hashPassword(newPassword.pass, salt);
// }
// else {
// selectedUser.salt = salt;
// selectedUser.pass = await this.hashPassword(newPassword.pass, salt);
// }
// try {
// await this.pcduserRepository.save(selectedUser);
// return { msg: "Your password changed sucessfully.", status: "Y" }
// } catch (error) {
// // if(error.code==23505) not working in orcale
// console.log("====error====", error);
// throw new BadRequestException(error.message);
// }
// }
// async changePasswordEmail(id: string, user: PcduserDto, body: PcduserDto): Promise<{ msg: string }> {
// const salt = await bcrypt.genSalt();
// const selectedUser = await this.pcduserRepository.findOne(id);
// if (!selectedUser)
// throw new BadRequestException("No such user exist");
// selectedUser.salt = salt;
// const password: string = generate({ length: 10, lowercase: true, numbers: true, uppercase: true });
// selectedUser.pass = await this.hashPassword(password, salt);
// try {
// await this.iuserRepository.save(selectedUser);
// await this.sendMail(selectedUser.email, password);
// await this.smsService.sendSms(selectedUser.mobileNumber, "Please check your email for new password");
// return { msg: "Please check your email for new password" };
// } catch (error) {
// // if(error.code==23505) not working in orcale
// console.log("====error====", error);
// throw new BadRequestException(error.message);
// }
// }
// async changePasswordCurrentUser(passwords: { currentPwd: string, pass: string, deviceId?: string }, id: string, user: PcduserDto): Promise<{ msg: string, status: string }> {
// let authcredentialsDto = new AuthCreadentialsDto();
// authcredentialsDto.password = passwords.currentPwd;
// authcredentialsDto.username = user.mobileNumber;
// authcredentialsDto.deviceId = passwords.deviceId;
// const currentUser = await this.validateUserPassword(authcredentialsDto);
// console.log(currentUser);
// if (currentUser) {
/* const connection = await this.createConnection(user.bankId);
try {
let mobCustQuery = `SELECT CUST_ID "cust",mcode||'/'||memno "custId" ,CUST_NAME "custName" ,MOBILE "mobile",decript_pwd(mpin) as "mPin",
decript_pwd(nvl(tpin,mpin)) as "tPin",'001' "bankId"
FROM PACS_MOB_CUST PMC WHERE PMC.MOBILE = '${user.mobileNumber}' AND PMC.ISACTIVE = '1'`
const mobCustData = await connection.execute(mobCustQuery, [], { outFormat: oracledb.OBJECT });
console.log(mobCustData.rows[0]);
if (mobCustData.rows[0]?.mPin == passwords.pass) {
return { msg: "Generated Password Cannot be same as New Password", status:"N" }
}
}
catch (err) {
console.log(err)
} finally {
this.closeConnection(connection)
}*/
// return await this.changePasswordManual(passwords, user.userId, user, 'P');
// }
// }
// async changeTransactionPinCurrentUser(passwords: { currentPwd: string, pass: string, deviceId?: string }, id: string, user: PcduserDto): Promise<{ msg: string }> {
// let authcredentialsDto = new AuthCreadentialsDto();
// authcredentialsDto.password = passwords.currentPwd;
// authcredentialsDto.username = user.mobileNumber;
// authcredentialsDto.deviceId = passwords.deviceId
// const currentUser = await this.validateTransactionPassword(authcredentialsDto);
// if (currentUser) {
// return await this.changePasswordManual(passwords, user.userId, user, 'T');
// }
// }
// async changeTransactionPinMpinCurrentUser(passwords: ChangePasswordDto): Promise<{ msg: string }> {
// let authcredentialsDto = new AuthCreadentialsDto();
// let user: PcduserDto
// user = await this.pcduserRepository.findOne({ mobileNumber: passwords.mobNo });
// console.log("changebothpin");
// authcredentialsDto.password = passwords.pass;
// authcredentialsDto.username = user.mobileNumber;
// authcredentialsDto.deviceId = passwords.deviceId;
// // authcredentialsDto.tpassword = passwords.tpass;
// // const currentUser = await this.validateUserPassword(authcredentialsDto);
// // console.log("currentuser", currentUser);
// if (user) {
// return await this.changePasswordManual(passwords, user.userId, user, 'A');
// }
// }
private async hashPassword(password: string, salt: string): Promise<string> {
return await bcrypt.hash(password, salt);
}
// async googleSignIn(mediaData: any, ip?: string): Promise<TokenDto> {
// let pcduser: PcduserDto;
// pcduser = await this.pcduserRepository.findOne({ email: mediaData.email });
// if (!pcduser) {
// // pcduser = await this.tempSignUp({ email: mediaData.email, username: mediaData.name, password: '' })
// // throw new UnauthorizedException('User Not registered..');
// }
// return await this.generateTokens(pcduser, pcduser.userName, ip, ""); //specify the module here
// }
}

@ -16,4 +16,6 @@ export class AuthCreadentialsDto {
email: string;
secuLevel: any;
}

@ -35,4 +35,6 @@ export class PcduserDto {
tSalt: string | null;
deviceId:string;
otp?:string;
}

@ -19,13 +19,10 @@ export class TempSignUpDto {
@IsString()
@MinLength(4)
@MaxLength(20)
// @Matches(/((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$/,
// { message: 'password is too weak' }
// )
password: string;
tpassword?: string;
// @IsIn(["T","C"])
// userCategory: string;
mobile?:string;
}

@ -9,4 +9,6 @@ export class TokenDto {
module: string;
changePassword?:string
secuLevel?:string
}

@ -9,7 +9,7 @@ export class Pcduser extends PcdBaseEntity {
name: "user_id",
primary: true,
type: "varchar",
length: 12
length: 12,
})
userId: string;
@Column({
@ -111,7 +111,8 @@ export class Pcduser extends PcdBaseEntity {
@Column({
name: "device_id",
type: "varchar"
type: "varchar",
nullable: true,
})
deviceId:string;
@ -132,6 +133,7 @@ export class Pcduser extends PcdBaseEntity {
})
bankId: string;
@Column({
nullable:true,
name: "t_pass",
type: "varchar",
length: 500
@ -147,20 +149,15 @@ export class Pcduser extends PcdBaseEntity {
})
tSalt: string | null;
async validatePassword(password: string,user ): Promise<boolean> {
if((user.deviceId==='null' || user.deviceId==="" || user.deviceId === undefined) && (user.bankId !='acc1' && user.bankId != 'sims')){
throw new BadRequestException("Device not Registered.Please Register");
}else{
const hash = await bcrypt.hash(password, this.salt);
return hash === this.pass;
}
}
async validateTransactionPassword(password: string): Promise<boolean> {
const hash = await bcrypt.hash(password, this.tSalt);
return hash === this.tPass;
// async validateTransactionPassword(password: string): Promise<boolean> {
// const hash = await bcrypt.hash(password, this.tSalt);
// return hash === this.tPass;
}
// }
}

@ -0,0 +1,5 @@
export class DocumentTypeDto{
id:number;
documentType:string;
}

@ -0,0 +1,12 @@
export class TenderDocumentDto{
tender_id:string;
doc_name:string;
description:string;
doc_type:string;
doc_size:number;
}

@ -1,12 +1,18 @@
import { Controller, Get, Param, Post, Req, Res, UploadedFile, UseGuards, UseInterceptors } from '@nestjs/common';
import { BadRequestException, Controller, Get, Param, Post, Req, Res, UploadedFile, UseGuards, UseInterceptors } from '@nestjs/common';
import { AuthGuard } from '@nestjs/passport';
import { FileInterceptor } from '@nestjs/platform-express';
import { existsSync, mkdirSync } from 'fs';
import { diskStorage } from 'multer';
import { extname } from 'path';
import { GetUser } from 'src/auth/dto/get-user.decorator';
import { FileUploadService } from './file-upload.service';
import * as fs from 'fs';
import * as archiver from 'archiver';
import * as path from 'path';
export function createFolders(filePath: string) {
const splitPath = filePath.split('/');
splitPath.reduce((path, subPath) => {
let currentPath;
@ -27,6 +33,146 @@ export function createFolders(filePath: string) {
@Controller('file-upload')
export class FileUploadController {
constructor(
private iservice: FileUploadService
) {
}
@Post('user-documents/:id')
@UseInterceptors(FileInterceptor('file', {
storage: diskStorage({
destination: (req, res, cb) => {
const filePath: string = './uploads/userDocuments/'+req.params.id;
createFolders(filePath);
return cb(null, filePath);
},
filename: (req, file, cb) => {
console.log('===here===file upload==');
const randomName = Array(32).fill(null).map(() => (Math.round(Math.random() * 16)).toString(16)).join('');
return cb(null, `${randomName}${extname(file.originalname)}`);
}
})
}))
userDoc(@UploadedFile() file) {
return { fileName: file.filename, filePath: file.path };
}
@Post('Bank-documents/:id')
@UseInterceptors(FileInterceptor('file', {
storage: diskStorage({
// destination: './uploads/cars',
destination: (req, res, cb) => {
// console.log(req);
const filePath: string = './uploads/BankDocuments/'+req.params.id;
createFolders(filePath);
return cb(null, filePath);
},
filename: (req, file, cb) => {
console.log('===here===file upload==');
const randomName = Array(32).fill(null).map(() => (Math.round(Math.random() * 16)).toString(16)).join('');
return cb(null, `${randomName}${extname(file.originalname)}`);
}
})
}))
bankDoc(@UploadedFile() file) {
if (!file) {
return { error: 'No file uploaded.' };
}
//To return the size of the document in kb
const fileSizeKB = Math.ceil(file.size / 1024);
return { fileName: file.filename, filePath: file.path, fileSizeKB };
}
@Get('Bank-Documents/:id/:imgpath')
getBankDocuments(
@Param('imgpath') image: string,
@Param('id') id: string,
@Res() res,
@Req() req,
) {
return res.sendFile(image, { root: './uploads/BankDocuments/'+id}, function (err) {
if (err) {
console.log(err.status);
res.status(err.status).end();
}
})
}
@Get('user-Documents/:id/:imgpath')
getUserDocuments(
@Param('imgpath') image: string,
@Param('id') id: string,
@Res() res,
@Req() req,
) {
return res.sendFile(image, { root: './uploads/userDocuments/'+id}, function (err) {
if (err) {
console.log(err.status);
res.status(err.status).end();
}
})
}
@Get('Bank-Documents-Arc/:id')
async getBankDocumentsAsZip(
@Param('id') id: string,
@Res() res,
@Req() req,
) {
const folderPath = path.join('./uploads/BankDocuments', id);
if (!fs.existsSync(folderPath)) {
res.status(404).send({ error: 'File not found' });
return;
}
const zipFileName = id + '.zip';
const zipPath = path.join('./uploads/BankDocuments', zipFileName);
// Create a new archive
const archive = archiver('zip', {
zlib: { level: 9 } // Set compression level (optional)
});
// Create a write stream to the zip file
const output = fs.createWriteStream(zipPath);
// Pipe the archive to the write stream
archive.pipe(output);
// Add the entire folder to the archive
archive.directory(folderPath, id);
// Finalize the archive
await archive.finalize();
// Set the appropriate headers for downloading the zip file
res.attachment(zipFileName);
res.setHeader('Content-Type', 'application/zip');
// Stream the zip file to the response
const readStream = fs.createReadStream(zipPath);
readStream.pipe(res);
// Remove the temporary zip file once it's streamed
readStream.on('end', () => {
fs.unlinkSync(zipPath);
});
// Handle any errors that occur during the archiving process
archive.on('error', function (err) {
console.log(err);
res.status(500).send({ error: 'Failed to create the zip file' });
});
}
}

@ -0,0 +1,15 @@
import { Controller } from '@nestjs/common';
import { DocumentTypeDto } from 'src/dto/document-type.dto';
import { PcdFormGridController } from 'src/framework/beans/pcd-form-grid.controller';
import { DocumentTypeService } from './document-type.service';
@Controller('document-type')
export class DocumentTypeController extends PcdFormGridController<DocumentTypeDto>{
constructor(
private documentTypeService: DocumentTypeService
) {
super(documentTypeService);
}
}

@ -0,0 +1,23 @@
import { PcdBaseEntity } from "src/framework/custom/pcd-entity.custom";
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from "typeorm";
import { TenderDoc } from "../tender-documents/tender-doc.entity";
@Entity('document-type')
export class DocumentType extends PcdBaseEntity{
@PrimaryGeneratedColumn({
name:"id"
})
id:number
@Column({
name:"document-type",
type:"varchar",
length:500,
nullable:true
})
documentType:string
@OneToMany(() => TenderDoc, (tenderDoc) => tenderDoc.documentTypeD )
tenderDoc:TenderDoc[]
}

@ -0,0 +1,14 @@
import { Module } from '@nestjs/common';
import { DocumentTypeController } from './document-type.controller';
import { DocumentTypeService } from './document-type.service';
import { TypeOrmModule } from '@nestjs/typeorm';
import { DocumentTypeRepository } from './document-type.repository';
@Module({
imports: [
TypeOrmModule.forFeature([DocumentTypeRepository])
],
controllers: [DocumentTypeController],
providers: [DocumentTypeService]
})
export class DocumentTypeModule {}

@ -0,0 +1,7 @@
import { EntityRepository, Repository } from "typeorm";
import { DocumentType } from "./document-type.entity";
@EntityRepository(DocumentType)
export class DocumentTypeRepository extends Repository<DocumentType>{
}

@ -0,0 +1,17 @@
import { Injectable } from '@nestjs/common';
import { InjectRepository } from '@nestjs/typeorm';
import { DocumentTypeDto } from 'src/dto/document-type.dto';
import { PcdFormGridService } from 'src/framework/beans/pcd-form-grid.service';
import { DocumentTypeRepository } from './document-type.repository';
@Injectable()
export class DocumentTypeService extends PcdFormGridService<DocumentTypeDto>{
constructor(
@InjectRepository(DocumentTypeRepository)
private documentTypeRepository: DocumentTypeRepository,
) {
super(documentTypeRepository);
}
}

@ -1,5 +1,5 @@
import { PcdBaseEntity } from "src/framework/custom/pcd-entity.custom";
import { TenderMaster } from "src/tender-master/tender-master.entity";
import { TenderMaster } from "src/tables/tender-master/tender-master.entity";
import { Column, Entity, OneToMany, PrimaryGeneratedColumn } from "typeorm";
@Entity('emd_fee_type')

@ -4,7 +4,8 @@ import { EmdFeeTypeService } from './emd-fee-type.service';
import { TypeOrmModule } from '@nestjs/typeorm';
import { EmdFeeTypeRepository } from './emd-fee-type.repository';
@Module({ imports: [
@Module({
imports: [
TypeOrmModule.forFeature([EmdFeeTypeRepository])
],
controllers: [EmdFeeTypeController],

@ -1,5 +1,5 @@
import { PcdBaseEntity } from "src/framework/custom/pcd-entity.custom";
import { TenderMaster } from "src/tender-master/tender-master.entity";
import { TenderMaster } from "src/tables/tender-master/tender-master.entity";
import { Column, Entity, OneToMany, PrimaryColumn, PrimaryColumnCannotBeNullableError, PrimaryGeneratedColumn } from "typeorm";
@Entity('form_of_contract')

@ -1,5 +1,5 @@
import { PcdBaseEntity } from "src/framework/custom/pcd-entity.custom";
import { TenderMaster } from "src/tender-master/tender-master.entity";
import { TenderMaster } from "src/tables/tender-master/tender-master.entity";
import { Column, Entity, JoinColumn, ManyToOne, PrimaryColumn } from "typeorm";
@Entity('imp-doc')

@ -1,5 +1,5 @@
import { PcdBaseEntity } from "src/framework/custom/pcd-entity.custom";
import { TenderMaster } from "src/tender-master/tender-master.entity";
import { TenderMaster } from "src/tables/tender-master/tender-master.entity";
import { Column, Entity, JoinColumn, ManyToOne, PrimaryColumn } from "typeorm";
@Entity('payment-instrument')

@ -1,5 +1,5 @@
import { PcdBaseEntity } from "src/framework/custom/pcd-entity.custom";
import { TenderMaster } from "src/tender-master/tender-master.entity";
import { TenderMaster } from "src/tables/tender-master/tender-master.entity";
import { Column, Entity, JoinColumn, ManyToOne, OneToMany, PrimaryColumn, PrimaryGeneratedColumn } from "typeorm";
@Entity('payment-mode')

@ -1,5 +1,5 @@
import { PcdBaseEntity } from "src/framework/custom/pcd-entity.custom";
import { TenderMaster } from "src/tender-master/tender-master.entity";
import { TenderMaster } from "src/tables/tender-master/tender-master.entity";
import { Column, Entity, OneToMany, PrimaryColumn, PrimaryGeneratedColumn } from "typeorm";
@Entity("product_category")

@ -1,5 +1,5 @@
import { PcdBaseEntity } from "src/framework/custom/pcd-entity.custom";
import { TenderMaster } from "src/tender-master/tender-master.entity";
import { TenderMaster } from "src/tables/tender-master/tender-master.entity";
import { Column, Entity, JoinColumn, ManyToOne, OneToMany, PrimaryColumn, PrimaryGeneratedColumn } from "typeorm";
@Entity('tender_category')

@ -0,0 +1,15 @@
import { Controller } from '@nestjs/common';
import { TenderDocumentDto } from 'src/dto/tender-document.dto';
import { PcdFormGridController } from 'src/framework/beans/pcd-form-grid.controller';
import { TenderDocService } from './tender-doc.service';
@Controller('tender-doc')
export class TenderDocController extends PcdFormGridController<TenderDocumentDto>{
constructor(
private tenderDocService: TenderDocService
) {
super(tenderDocService);
}
}

@ -1,6 +1,7 @@
import { PcdBaseEntity } from "src/framework/custom/pcd-entity.custom";
import { TenderMaster } from "src/tender-master/tender-master.entity";
import { TenderMaster } from "src/tables/tender-master/tender-master.entity";
import { Column, Entity, JoinColumn, ManyToOne, PrimaryColumn } from "typeorm";
import { DocumentType } from "../document-type/document-type.entity";
@Entity("tender-doc")
export class TenderDoc extends PcdBaseEntity{
@ -25,7 +26,6 @@ export class TenderDoc extends PcdBaseEntity{
@Column({
name:"doc_type",
type:"varchar",
length:500,
nullable:true
})
docType:string
@ -37,10 +37,21 @@ export class TenderDoc extends PcdBaseEntity{
})
description:string
@Column({
name:"document_size",
type:"numeric",
nullable:true
})
documentSize:number;
@ManyToOne(() => TenderMaster,(tenderMaster)=> tenderMaster.importantDoc)
@ManyToOne(() => TenderMaster,(tenderMaster)=> tenderMaster.TenderDoc)
@JoinColumn([{ name: "tender_id", referencedColumnName: "id" }])
tenderIdD:TenderMaster
@ManyToOne(() => DocumentType,(documentType)=> documentType.tenderDoc,{eager:true})
@JoinColumn([{ name: "doc_type", referencedColumnName: "id" }])
documentTypeD:DocumentType
}

@ -0,0 +1,14 @@
import { Module } from '@nestjs/common';
import { TenderDocService } from './tender-doc.service';
import { TenderDocController } from './tender-doc.controller';
import { tenderDocRepository } from './tender-doc.repository';
import { TypeOrmModule } from '@nestjs/typeorm';
@Module({
imports: [
TypeOrmModule.forFeature([tenderDocRepository])
],
providers: [TenderDocService],
controllers: [TenderDocController]
})
export class TenderDocModule {}

@ -0,0 +1,17 @@
import { Injectable } from '@nestjs/common';
import { PcdFormGridService } from 'src/framework/beans/pcd-form-grid.service';
import { tenderDocRepository } from './tender-doc.repository';
import { InjectRepository } from '@nestjs/typeorm';
import { TenderDocumentDto } from 'src/dto/tender-document.dto';
@Injectable()
export class TenderDocService extends PcdFormGridService<TenderDocumentDto>{
constructor(
@InjectRepository(tenderDocRepository)
private tenderDocRepository: tenderDocRepository,
) {
super(tenderDocRepository);
}
}

@ -1,13 +1,13 @@
import { PcdBaseEntity } from "src/framework/custom/pcd-entity.custom";
import { ImportantDoc } from "src/imp-doc/imp-doc.entity";
import { paymentInstrument } from "src/payment-instrument/payment-ins.entity";
import { ImportantDoc } from "src/tables/imp-doc/imp-doc.entity";
import { paymentInstrument } from "src/tables/payment-instrument/payment-ins.entity";
import { EmdFeeType } from "src/tables/emd-fee-type/emd-fee-type.entity";
import { FormOfContract } from "src/tables/form-of-contract/form-of-contract.entity";
import { PaymentMode } from "src/tables/payment-mode/payment-mode.entity";
import { ProductCategory } from "src/tables/product-category/product-category.entity";
import { TenderCategory } from "src/tables/tender-category/tender-category.entity";
import { TenderType } from "src/tables/tender-type/tender-type.entity";
import { TenderDoc } from "src/tender-doc/tender-doc.entity";
import { TenderDoc } from "src/tables/tender-documents/tender-doc.entity";
import { Column, Entity, JoinColumn, ManyToOne, OneToMany, PrimaryColumn, PrimaryGeneratedColumn } from "typeorm";
@Entity('tender_master')
@ -357,6 +357,7 @@ export class TenderMaster extends PcdBaseEntity{
})
activeYn:string
@OneToMany(() => ImportantDoc, (importantDoc) => importantDoc.tenderIdD )
importantDoc:ImportantDoc[]

@ -1,5 +1,5 @@
import { PcdBaseEntity } from "src/framework/custom/pcd-entity.custom";
import { TenderMaster } from "src/tender-master/tender-master.entity";
import { TenderMaster } from "src/tables/tender-master/tender-master.entity";
import { Column, Entity, JoinColumn, ManyToOne, OneToMany, PrimaryColumn, PrimaryGeneratedColumn } from "typeorm";
@Entity('tender-type')

@ -0,0 +1,4 @@
import { Controller } from '@nestjs/common';
@Controller('tender')
export class TenderController {}

@ -0,0 +1,9 @@
import { Module } from '@nestjs/common';
import { TenderController } from './tender.controller';
import { TenderService } from './tender.service';
@Module({
controllers: [TenderController],
providers: [TenderService]
})
export class TenderModule {}

@ -0,0 +1,7 @@
import { Injectable } from '@nestjs/common';
import { TenderDetailDto } from 'src/dto/tender-master.dto';
import { PcdTransactionService } from 'src/framework/beans/pcd-transaction.service';
import { TransactionDetailDto } from 'src/framework/custom/transaction-detail.dto';
@Injectable()
export class TenderService{}
Loading…
Cancel
Save