-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make saveJobDetails query, update handlebars
Closes #93
- Loading branch information
Showing
12 changed files
with
75 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
const { addUserStatus } = require('./middleware'); | ||
const getMemberData = require('../model/queries/getMemberData'); | ||
|
||
exports.get = (req, res) => { | ||
let user = addUserStatus(req); | ||
res.render('profile', { activePage: { profile: true }, user }); | ||
// const user = addUserStatus(req); | ||
// console.log('user: ', user); | ||
getMemberData(req.user.github_id).then((user) => { | ||
console.log(user); | ||
res.render('profile', { activePage: { profile: true }, user }); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
const db = require('../database/db_connection'); | ||
|
||
const saveJobDetails = (formData, githubId) => { | ||
const parsedYears = JSON.parse(formData.years_experience.replace(/'/g, '"')); | ||
|
||
const objCopy = JSON.parse(JSON.stringify(formData)); | ||
objCopy.min_years_exp = parsedYears.min_years_exp; | ||
objCopy.max_years_exp = parsedYears.max_years_exp; | ||
delete objCopy.years_experience; | ||
const values = Object.values(objCopy); | ||
values.push(githubId); | ||
|
||
return db.query( | ||
'UPDATE members SET job_view_pref = $1, job_search_status = $2, github_cv_url = $3, cv_url = $4, min_years_exp = $5, max_years_exp = $6 WHERE github_id = $7', | ||
values, | ||
).then(() => console.log(`${githubId} member job info posted to DB`)) | ||
.catch((error) => { | ||
throw new Error(error.message); | ||
}); | ||
}; | ||
|
||
module.exports = saveJobDetails; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
module.exports = (jobViewPref) => { | ||
return jobViewPref === 'public'; | ||
} | ||
if (jobViewPref === 'public') { | ||
return 'eye icon'; | ||
} | ||
return 'lock icon'; | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters