0% found this document useful (0 votes)
15 views20 pages

Index Js (Front)

The document defines routes and middleware for a job board application. It requires models and modules for user authentication, file uploads, sending emails and more. The routes include getting job listings based on filters, individual job details, courses, contact pages and more.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views20 pages

Index Js (Front)

The document defines routes and middleware for a job board application. It requires models and modules for user authentication, file uploads, sending emails and more. The routes include getting job listings based on filters, individual job details, courses, contact pages and more.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 20

const express = require("express");

const AWS = require("aws-sdk");


const uuid = require("uuid/v1");
const moment = require("moment");
// const pdf = require('pdf-parse');
// const fs = require('fs');
// const multer = require('multer');
// const upload = multer();
// const OpenAI = require('openai');

const {
User,
Company,
College,
Candidate,
SkillTest,
CareerObjective,
CoverLetter,
MockInterview,
Vacancy,
State,
City,
Qualification,
Industry,
Courses
} = require("../../models");
const bcrypt = require("bcryptjs");
const router = [Link]();
const {
bucketName,
accessKeyId,
secretAccessKey,
region,
mimetypes,
bucketURL
} = require("../../../config");
const CompanyExecutive = require("../../models/companyExecutive");
const collegeRepresentative = require("../../models/collegeRepresentative");
const { generatePassword, sendMail } = require("../../../helpers");
const { Translate } = require('@google-cloud/translate').v2;
const { translateProjectId, translateKey } = require('../../../config')

[Link]({ accessKeyId, secretAccessKey, region });


const s3 = new AWS.S3({ region, signatureVersion: "v4" });

const nodemailer = require("nodemailer");


const { ObjectId } = require("mongoose").Types;

var transporter = [Link]({


service: '"gmail"',
port: 587,
secure: true,
auth: {
user: "lovepreetlavi697@[Link]",
pass: "blwwclfkawgmbwwk",
},
});

[Link]("/", async (req, res) => {


try {
const data = [Link]
let { qualification, experience, industry, jobType, state, Salary } =
[Link]
if (qualification && ![Link](qualification)) {
qualification = ''
}
if (experience && isNaN(experience)) {
experience = ''
}
if (industry && ![Link](industry)) {
industry = ''
}
if (jobType && (jobType != 'Part Time' && jobType != 'Full Time')) {
jobType = ''
}
if (state && ![Link](state)) {
state = ''
}
if (Salary && isNaN(Salary)) {
Salary = ''
}
let filter = { status: true, _company: { $ne: null }, validity: { $gte:
moment().utcOffset('+05:30') },verified:true }
if (qualification) {
filter._qualification = qualification
}
if (industry) {
filter._industry = industry
}
if (jobType) {
[Link] = jobType
}
if (experience) {
experience == "0"
? (filter["$or"] = [
{ experience: { $lte: experience } },
])
: (filter["experience"] = { $lte: experience });
}
if (state) {
[Link] = state
}
if (Salary) {
filter["$or"] = [{ isFixed: true, amount: { $gte: Salary } },
{ isFixed: false, max: { $gte: Salary } }]
}

const allQualification = await [Link]({ status:


true }).sort({ basic: -1 })
const allIndustry = await [Link]({ status: true })
const allStates = await [Link]({ countryId: '101', status: { $ne:
false } })
const countJobs = await [Link](filter).countDocuments()
const perPage = 10;
const p = parseInt([Link]);
const page = p || 1;
const totalPages = [Link](countJobs / perPage);
let recentJobs = await [Link](filter).populate([
{
path: '_company',
select: "name logo stateId cityId"
},
{
path: "_industry",
select: "name",
},
{
path: "_jobCategory",
select: "name",
},
{
path: "_qualification",
select: "name",
},
{
path: "state",
select: "name",
},
{
path: "city",
select: "name",
},]).sort({ sequence: 1, createdAt: -1 }).skip(perPage * page -
perPage).limit(perPage);

rePath = [Link](`${[Link]}/front`, {
recentJobs, allQualification, allIndustry, allStates, data,
totalPages, page,
});
} catch (err) {
const ipAddress = [Link]('x-forwarded-for') ||
[Link];
[Link]('======================> 1', ipAddress, [Link]?.mobile,
[Link]?.name, err)
[Link]("error", [Link] || "Something went wrong!");
// return [Link]("back");
}
});

[Link]("/corporate-pricing-plan", (req, res) => {


rePath = [Link](`${[Link]}/front/corporatePricingPlan`, {
});
});

[Link]("/employersTermsofService", (req, res) => {


rePath = [Link](`${[Link]}/front/employersTermsofService`, {
});
});

[Link]("/userAgreement", (req, res) => {


rePath = [Link](`${[Link]}/front/userAgreement`, {
});
});
[Link]("/joblisting", async (req, res) => {
const data = [Link];
let filter = { status: true, _company: { $ne: null }, validity: { $gte:
moment().utcOffset('+05:30') },verified:true }
let populate = [
{
path: '_company',
select: "name logo stateId cityId"
},
{
path: "_industry",
select: "name",
},
{
path: "_jobCategory",
select: "name",
},
{
path: "_qualification",
select: ["name"],
},
{
path: "state"
},
{
path: "city",
select: "name",
}
]

const countJobs = await [Link](filter).countDocuments()


const perPage = 9;
const p = parseInt([Link]);
const page = p || 1;
const totalPages = [Link](countJobs / perPage);
let recentJobs = await
[Link](filter).populate(populate).sort({ sequence: 1, createdAt: -
1 }).skip(perPage * page - perPage).limit(perPage)
rePath = [Link](`${[Link]}/front/joblisting`, {
recentJobs,
totalPages,
page,
data,

});
});

[Link]("/jobsearch", (req, res) => {

rePath = [Link](`${[Link]}/front/jobsearch`, {
});
});
[Link]("/jobsearch", (req, res) => {
const {body}=[Link];

rePath = [Link](`${[Link]}/front/jobsearch`, {
});
});
[Link]("/courses", async (req, res) => {
let filter = { status: true}
const countJobs = await [Link](filter).countDocuments()
const perPage = 9;
const p = parseInt([Link]);
const page = p || 1;
const totalPages = [Link](countJobs / perPage);
let courses = await [Link](filter).sort({ createdAt: -
1 }).skip(perPage * page - perPage).limit(perPage)
rePath = [Link](`${[Link]}/front/courses`, {
courses,
totalPages,
page
});
});
[Link]("/coursedetails/:id", async(req, res) => {
const {id}=[Link]
let course=await [Link]({_id:id})
rePath = [Link](`${[Link]}/front/coursedetails`, {
course
});
});
[Link]("/contact", (req, res) => {
rePath = [Link](`${[Link]}/front/contact`, {
});
});
[Link]("/contactt", (req, res) => {
rePath = [Link](`${[Link]}/front/contactUs`, {
});
});
[Link]("/sampleVideoProfile", (req, res) => {
rePath = [Link](`${[Link]}/front/sampleVideoProfile`, {
});
});
[Link]("/coursedetailmore", (req, res) => {
[Link]('=========== reached')
rePath = [Link](`${[Link]}/front/coursedetailmore`, {
});
});
[Link]("/jobdetailsmore/:jobId", async(req, res) => {
try{
[Link]('=======================> reached here')
let jobId = [Link]
if (jobId && ![Link](jobId)) {
throw [Link]("Invalid Job Id");
}
const populate = [
{
path: '_company',
select: "name logo stateId cityId mediaGallery
mediaGalaryVideo"
},
{
path: "_industry",
select: "name",
},
{
path: "_jobCategory",
select: "name",
},
{
path: "_qualification",
select: "name",
},
{
path: "state",
select: "name",
},
{
path: "city",
select: "name",
},
{
path: "_techSkills",
select: "name",
},
{
path: "_nonTechSkills",
select: "name",
},

];
const job = await [Link]({ _id:
jobId }).populate(populate)
let state = '';
let city = '';
if (job._company?.stateId && job._company?.cityId) {
state = await [Link]({ _id: job._company.stateId,
status: true })
city = await [Link]({ _id: job._company.cityId,
status: true, stateId: job._company.stateId })
}
const recentJobs = await [Link]({ status: true, _id: { $ne:
jobId } }).populate([
{
path: '_company',
select: "name logo"
},
{
path: "city",
select: "name",
}]).sort({ createdAt: -1 }).limit(5)
rePath = [Link](`${[Link]}/front/jobdetailmore`, {
job, recentJobs, state, city
});
}catch(err){
[Link](err,'err>>>>>>>>>>>>')
}
});
[Link]("/contact", (req, res) => {
rePath = [Link](`${[Link]}/front/contact`, {
});
});
[Link]("/jobdetails/:jobId", async (req, res) => {
try {
let jobId = [Link] //63d8cb2e421777708eaed0d8
if (jobId && ![Link](jobId)) {
throw [Link]("Invalid Job Id");
}
const populate = [
{
path: '_company',
select: "name logo stateId cityId mediaGallery
mediaGalaryVideo"
},
{
path: "_industry",
select: "name",
},
{
path: "_jobCategory",
select: "name",
},
{
path: "_qualification",
select: "name",
},
{
path: "state",
select: "name",
},
{
path: "city",
select: "name",
},
{
path: "_techSkills",
select: "name",
},
{
path: "_nonTechSkills",
select: "name",
},

];
const job = await [Link]({ _id: jobId }).populate(populate)
let state = '';
let city = '';
if (job._company?.stateId && job._company?.cityId) {
state = await [Link]({ _id: job._company.stateId, status:
true })
city = await [Link]({ _id: job._company.cityId, status:
true, stateId: job._company.stateId })
}
const recentJobs = await [Link]({ status: true, _id: { $ne: jobId
} }).populate([
{
path
: '_company',
select: "name logo"
},
{
path: "city",
select: "name",
}]).sort({ createdAt: -1 }).limit(5)

return [Link](`${[Link]}/front/jobdetails`, { job, recentJobs,


state, city });
} catch (err) {
const ipAddress = [Link]('x-forwarded-for') ||
[Link];
[Link]('======================> 2', ipAddress, [Link]?.mobile,
[Link]?.name, err)
[Link]("error", [Link] || "Something went wrong!");
return [Link]("back");
}
});
[Link]("/jobdetails", async (req, res) => {
try {
const data = [Link]
let { qualification, experience, industry, jobType, state, Salary } =
[Link]
if (qualification && ![Link](qualification)) {
qualification = ''
}
if (experience && isNaN(experience)) {
experience = ''
}
if (industry && ![Link](industry)) {
industry = ''
}
if (jobType && (jobType != 'Part Time' && jobType != 'Full Time')) {
jobType = ''
}
if (state && ![Link](state)) {
state = ''
}
if (Salary && isNaN(Salary)) {
Salary = ''
}
let populate = [
{
path: '_company',
select: "name logo stateId cityId"
},
{
path: "_industry",
select: "name",
},
{
path: "_jobCategory",
select: "name",
},
{
path: "_qualification",
select: ["name"],
},
{
path: "state"
},
{
path: "city",
select: "name",
}
]

let filter = { status: true, _company: { $ne: null }, validity: { $gte:


moment().utcOffset('+05:30') } }
if (qualification) {
filter._qualification = qualification
}
if (industry) {
filter._industry = industry
}
if (jobType) {
[Link] = jobType
}
if (experience) {
experience == "0"
? (filter["$or"] = [
{ experience: { $lte: experience } },
])
: (filter["experience"] = { $lte: experience });
}
if (state) {
[Link] = state
}
if (Salary) {
filter["$or"] = [{ isFixed: true, amount: { $gte: Salary } },
{ isFixed: false, min: { $gte: Salary } }]
}
const allQualification = await [Link]({ status:
true }).sort({ basic: -1 })
const allIndustry = await [Link]({ status: true })
const allStates = await [Link]({ countryId: '101', status: { $ne:
false } })
const countJobs = await [Link](filter).countDocuments()
const perPage = 10;
const p = parseInt([Link]);
const page = p || 1;
const totalPages = [Link](countJobs / perPage);
let recentJobs = await
[Link](filter).populate(populate).sort({ sequence: 1, createdAt: -
1 }).skip(perPage * page - perPage).limit(perPage)
return [Link](`${[Link]}/front/joblist`, {
recentJobs,
totalPages,
page,
data,
allQualification,
allIndustry,
allStates
});
} catch (err) {
const ipAddress = [Link]('x-forwarded-for') ||
[Link];
[Link]('======================> 3', ipAddress, [Link]?.mobile,
[Link]?.name, err)
[Link]("error", [Link] || "Something went wrong!");
// return [Link]("back");
}
});
[Link]("/jobdetailslist", async (req, res) => {
try {
let recentJobs = await [Link]({ status: true, _company: { $ne:
null } }).populate([
{
path: '_company',
select: "name logo stateId cityId"
},
{
path: "_industry",
select: "name",
},
{
path: "_jobCategory",
select: "name",
},
{
path: "_qualification",
select: "name",
},
{
path: "state",
select: "name",
},
{
path: "city",
select: "name",
},]).sort({ sequence: 1, createdAt: -1 }).limit(5);
[Link]((item) => {
if ([Link]) {
item._company.name = [Link]
}
if (item._company.logo && item._company.[Link](bucketURL) <
0) {
item._company.logo = bucketURL + "/" + item._company.logo
}
if ([Link]) {
[Link] =
moment([Link]).utcOffset('+05:30').format('DD MMM YYYY')
}
})
return [Link]({ status: true, recentJobs });
} catch (err) {
return [Link]({ status: false, err })
}
});
router
.route("/admin/login")
.get(async (req, res) => {
let rePath;
if ([Link] && [Link]) {
rePath = [Link](`${[Link]}/front/login`);
} else {
if ([Link] && [Link] === 0) {
rePath = [Link]("/admin");
} else if ([Link] && [Link] === 1) {
rePath = [Link]("/company/dashboard");
} else if ([Link] && [Link] === 3) {
rePath = [Link]("/candidate/dashboard");
} else if ([Link] && [Link] === 2) {
rePath = [Link]("/college/dashboard");
} else {
rePath = [Link](`${[Link]}/front/login`);
}
}
return rePath;
})
.post(async (req, res) => {
try {
const user = await [Link]({
email: [Link],
role: { $in: [0, 10] },
status: true,
});
// if (!user || user === null)
// throw [Link]("You are blocked by super admin");

if (!user || user === null)


throw [Link]("User not found. Enter a valid
credentials");

if (user && [Link] == false)


throw [Link]("Please Contact With Your Admin");

if (![Link]([Link]))
throw [Link]("Enter a valid password");

if (user) {
if ([Link] === 10 || [Link] === 0) {
let userData = { role: [Link], name: [Link],
_id: user._id, email: [Link] }
[Link] = userData;
return [Link]("/admin");
}
}
} catch (err) {
[Link]("error", [Link] || "Something went wrong!");
return [Link]("back");
}
});

[Link]("/admin/logout", async (req, res) => {


try {
[Link] = null;
return [Link]("/admin/login");
} catch (err) {
[Link]("error", [Link] || "Something went wrong!");
return [Link]("back");
}
});

[Link]("/admin/changestatus", async (req, res) => {


try {
const Model = require(`../../models/` + [Link]); // eslint-
disable-line
const updata = { $set: { status: [Link] } };
const data = await [Link]([Link], updata);
if ([Link] == "company" || [Link] == "college") {
const user = await [Link](data._concernPerson,
updata);
if ([Link] == 'false') {
const updateJobs = await [Link]({ _company:
data._id }, updata)
}
}
return [Link](data);
} catch (err) {
[Link]('err is ', err)
[Link]("error", "Something went wrong!");
return [Link]("back");
}
});

// Delete user : Nitin sehgal


[Link]("/admin/deleteRecord", async (req, res) => {
try {
const Model = require(`../../models/` + [Link]); // eslint-
disable-line
const updata = { $set: { isDeleted: true } };
const data = await [Link]([Link], updata);
if ([Link] == "candidate") {
const user0 = await [Link](
{ _id: data._concernPerson },
updata
);
}

if ([Link] == "company" || [Link] == "college") {


const user = await [Link](data._concernPerson,
updata);

if ([Link] == "company") {
const user0 = await [Link](
{ _company: data._id },
updata
);
}
if ([Link] == "college") {
// [Link]("innn", data);
const user1 = await [Link](
{
_college: data._id,
},
updata
);
}
//[Link](user1, "seconndddd");
}
return [Link](data);
} catch (err) {
[Link]("error", "Something went wrong!");
return [Link]("back");
}
});

[Link]("/admin/deleteArchieve", async (req, res) => {


try {
if ([Link] == "college") {
// [Link]("[Link] = ", data._id);
const user3 = await [Link]({ _id:
[Link] });
}

if ([Link] == "company") {
// [Link]("[Link] = ", data._id);
const user3 = await [Link]({ _id:
[Link] });
}

if ([Link] == "candidate") {
// [Link]("[Link] = ", data._id);
const user3 = await [Link]({ _id: [Link]
});
}

if ([Link] == "skillTest") {
// [Link]("[Link] = ", data._id);
const user3 = await [Link]({ _id: [Link]
});
}

if ([Link] == "careerObjective") {
// [Link]("[Link] = ", data._id);
const user3 = await [Link]({
_id: [Link],
});
}

if ([Link] == "coverLetter") {
// [Link]("[Link] = ", data._id);
const user3 = await [Link]({ _id:
[Link] });
}

if ([Link] == "mockInterview") {
// [Link]("[Link] = ", data._id);
const user3 = await [Link]({
_id: [Link],
});
}

if ([Link] == "vacancy") {
// [Link]("[Link] = ", data._id);
const user3 = await [Link]({ _id:
[Link] });
}

return [Link](data);
} catch (err) {
[Link]("error", "Something went wrong!");
return [Link]("back");
}
});

[Link]("/admin/s3upload", async (req, res) => {


try {
const { user } = [Link];
const { type, ext } = [Link];

if (!user || !user._id) throw [Link]("You are not authorized!");


if (!type || !ext || ![Link](ext))
throw [Link]("Invalid or unsupported file!");

const key = `uploads/${user._id}/${uuid()}.${ext}`;


const params = {
Bucket: bucketName,
ContentType: type,
Key: key,
};
return [Link]("putObject", params, (err, url) => {
if (err) throw err;
if (!url) throw [Link]();
return [Link]({ status: true, data: { url, key } });
});
} catch (err) {
return [Link](err);
}
});

[Link]("/admin/uploadVideo", (req, res) => {


try {
const { name, mimetype: ContentType } = [Link];
const ext = [Link](".").pop();
const key = `uploads/${uuid()}.${ext}`;
const data = [Link];
const params = {
Bucket: bucketName,
Body: data,
Key: key,
ContentType
};
[Link](params, function (err, data) {
return [Link]({ status: true, data });
})
}
catch (err) {
[Link](err);
[Link](500).send({ status: false, message: err })
}
})

//forget password

router
.route("/admin/forgotpassword")
.get(async (req, res) => {
rePath = [Link](`${[Link]}/front/forPass`);
return rePath;
})
.post(async (req, res) => {
try {
const email = [Link];
const tempPassword = await generatePassword();
const userData = await [Link]({ email: email });
if (!userData)
throw [Link](
"Invalid email, please enter your registered email"
);

if ([Link] == "3") throw [Link]("You are not


registered");

[Link](tempPassword, 10, async function (err, hash) {


let user = await [Link](
{ email: email },
{
password: hash,
}
);
});

var subject = "Focalyt - Forgot Password!";


var message = `
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-
scale=1">
</head>
<body>
<div>
<table border="0" cellpadding="0" cellspacing="0" style="height:
100%; width: 100%;">
<tbody>
<tr>
<td align="center" valign="top">
<table border="0" cellspacing="0" style="width: 600px;
">
<tbody>
<tr>
<td align="center" valign="top"
style="font-family:'Manrope',sans-serif!important">
<table border="0" cellspacing="0"
cellpadding="0 ="
style="background-color: #F4F3F3;
border-radius: 4px; overflow: hidden; text-align: center; width: 620px;">
<tbody>
<tr>
<td style="background-
color:#FC2B5A;color:#ffffff!important"
valign="top">
<a>
<img
src="[Link] alt="pic"

style="position: relative; background-color: #FC2B5A; display: block; margin: 40px


auto 0; width: 170px!important;background-repeat: no-repeat;padding-bottom: 50px;
">
</a>
</td>
</tr>
<tr>
<td style="font-
family:'Manrope',sans-serif!important;text-align:left;padding-left:65px;padding-
top:70px" >

<p style="line-height:32px;font-size:18px!important;font-
family:'Manrope',sans-serif!important">

Hi ${[Link]},<br/><br/>

Your Temporary Password : ${tempPassword}<br/> <br/>


</p>

<p style="line-height:32px;font-size:18px!important;font-
family:'Manrope',sans-serif!important">

Thank you,<br/>

Focalyt Group<br/> <br/>

Please contact mentory@[Link] if you have any questions.

</p>
</td>
</tr>
<tr>
<td style="font-family:
'manrope',sans-serif!important;text-align:left">
<ul style="list-style-
type: none;padding-left: 0px;margin: 20px 50px!important;">
<li style="padding-
top:0px">
<span
style="line-height:32px;font-size:18px!important;font-family:'Manrope',sans-serif!
important">
Sincerely,
<br/> Focalyt Group
</span>
</li>

</ul>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>
`;

sendMail(subject, message, email);

[Link](
"success",
"Your new password has been sent to your registered email.
Please check your email."
);
[Link]("/admin/forgotpassword");
} catch (err) {
[Link]("error", [Link] || "Something went wrong!");
return [Link]("back");
}
});

//change password
router
.route("/admin/changepassword")
.get(async (req, res) => {
rePath = [Link](`${[Link]}/admin/setting/changePass`, { menu:
'dashboard' });
// rePath = [Link](`${[Link]}/front/login`);
return rePath;
})
.post(async (req, res) => {
try {
const newpassword = [Link];
const oldpassword = [Link];
const confirmpassword = [Link];

if (newpassword !== confirmpassword)


throw [Link]("Passwords must be matched ");

const userData = await [Link]({ _id:


[Link]._id });
if (!userData) throw [Link]("User not found!");

if (![Link](oldpassword, [Link])) {
throw [Link]("Old password is incorrect!");
}

const user = [Link](newpassword, 10, async function (err,


hash) {
const user = await [Link](
{ _id: userData._id },
{
password: hash,
}
);
if (!user) throw [Link]("user not matched!");
[Link]("success", "Password has been changed!");
[Link] = null;
return [Link]("/admin/login");
});
} catch (err) {
[Link]("error", [Link] || "Something went wrong!");
return [Link]("back");
}
});

//edit profile
router
.route("/admin/editprofile")
.get(async (req, res) => {
var user = [Link];
rePath = [Link](`${[Link]}/admin/setting/editProfile`, {
user,
menu: 'dashboard'
});
// rePath = [Link](`${[Link]}/front/login`);
return rePath;
})
.post(async (req, res) => {
try {
const email = [Link];
const name = [Link];
var id = [Link]._id;

var userData = await [Link]({ email: email });


if (!userData)
throw [Link]("This email is already registered with
us");
var userData = await [Link](
{ _id: id },
{
// email: email,
name: name,
},
{
new: true,
}
);

[Link]("success", "Profile updated successfullly");


[Link] = userData;
return [Link]("back");
} catch (err) {
[Link]("error", [Link] || "Something went wrong!");
return [Link]("back");
}
});

[Link]('/about')
.get(async (req, res) => {
rePath = [Link](`${[Link]}/front/about`, {
});
})
[Link]('/about-us')
.get(async (req, res) => {
rePath = [Link](`${[Link]}/front/aboutUs`, {
});
})

[Link]('/termsandconditions')
.get(async (req, res) => {
rePath = [Link](`${[Link]}/front/termsAndConditions`, {
});
})

[Link]('/privacy-policy')
.get(async (req, res) => {
rePath = [Link](`${[Link]}/front/privacyPolicy`, {
});
})

[Link]('/return-and-refund-policy')
.get(async (req, res) => {
rePath = [Link](`${[Link]}/front/returnAndRefundPolicy`, {
});
})

[Link]('/contact-us')
.get(async (req, res) => {
rePath = [Link](`${[Link]}/front/contactUs`, {
});
})

[Link]('/signs')
.get(async (req, res) => {
[Link]('X-FRAME-OPTIONS', 'ALLOW-FROM *');
[Link]('Content-Security-Policy', "frame-ancestors *");
rePath = [Link](`${[Link]}/front/signs`, {
});
})

[Link]('/signConverter')
.get(async (req, res) => {
[Link]('X-FRAME-OPTIONS', 'ALLOW-FROM *');
[Link]('Content-Security-Policy', "frame-ancestors *");

rePath = [Link](`${[Link]}/front/signConverter`, {
});
})

[Link]('/voice')
.get(async (req, res) => {
[Link]('X-FRAME-OPTIONS', 'ALLOW-FROM *');
[Link]('Content-Security-Policy', "frame-ancestors *");
rePath = [Link](`${[Link]}/front/voice`, {
});
})

[Link]('/translate')
.post(async (req, res) => {
[Link]('X-FRAME-OPTIONS', 'ALLOW-FROM *');
[Link]('Content-Security-Policy', "frame-ancestors *");
const lang = [Link] ? [Link] : 'hi'
const message = [Link]?.toLowerCase();
[Link]('I received this message ', message)
const translate = new Translate({ projectId: translateProjectId, key:
translateKey });

[Link](message, lang).then(result => {


return [Link]({ status: true, message: result[0] });
})
.catch(err => {
[Link]('=========> Err', err)
return [Link]({ status: false, message: 'caught an error'
});
});

})

[Link]('/parser')
.get(async (req, res) => {
[Link]('X-FRAME-OPTIONS', 'ALLOW-FROM *');
[Link]('Content-Security-Policy', "frame-ancestors *");
rePath = [Link](`${[Link]}/front/parser`, {
});
})

// [Link]('/parsedocument', async (req, res) => {


// [Link]('X-FRAME-OPTIONS', 'ALLOW-FROM *');
// [Link]('Content-Security-Policy', "frame-ancestors *");

// let output = await pdf([Link])


// const prompt = `Extract the name, email, phone, linkedin, skype, companies
with name position and start/end date, address, total experience, technical_skills
and non_technical_skills skills from the following resume and
// calculate total experience in numbers, skills in array then return as json
object:\n"${[Link]}"`;
// const openai = new OpenAI({
// apiKey: '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', //
defaults to [Link]["OPENAI_API_KEY"]
// });

// const response = await [Link]({


// messages: [{ role: 'user', content: prompt }],
// model: 'gpt-3.5-turbo',
// });

// const extractedInfo = [Link][0].message;


// return [Link]({ status: true, output: [Link]([Link]) });
// })

[Link] = router;

You might also like