-
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.
Merge develop branch into main for Sprint 4 (#38)
- Loading branch information
1 parent
e90e749
commit fab0fd7
Showing
44 changed files
with
1,168 additions
and
296 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
GROUP_EMAIL=[email protected] | ||
CLIENT_ID=1052354276038-14skrtgl53180hdbag91vk32buoc3bd1.apps.googleusercontent.com | ||
CLIENT_SECRET=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 | ||
REFRESH_TOKEN=1//04gr_h2j1KQxkCgYIARAAGAQSNwF-L9Ir-FyAi8HZr3PTnU0Fn6WMq6UVpVCfiVXbBpQHIglLgBSdVgE-E-ybzMMEpzUKLQzhIx4 | ||
CLIENT_ID=1052354276038-dvs2amldtngierae907553p4i40lcg5t.apps.googleusercontent.com | ||
CLIENT_SECRET=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 | ||
REFRESH_TOKEN=1//04p9TDi3BW4kZCgYIARAAGAQSNwF-L9IrLRfzg2YR_hUmH056NNsc7OZJYNngT4ySBxQoi_9yxK_w1Te2cVwxISney3fcRBRfmCU | ||
ACCESS_TOKEN=ya29.a0AXooCgvaKx-2ILO6LmSRpyF3R_w0yiVcaQn28K_YChh-rNA4r7ooQUer2ISom0FA6NMk2LmL6oa6A2sl0K3Eek9X_X7vAotzNrQUpL0EvmF31KeDc-QHkMVueUN8i7HQ63-n0oo2p2ywaNm3YVZ87m-aqujF9nkHClqIaCgYKAVYSARISFQHGX2MiuPCr8QsOL6t4kYg5cxj-mQ0171 | ||
ACCESS_TOKEN_SECRET_FORJWT=5AFXgIWj8SAilS0T3ph0q2GEf7xzSYdXjCDMhrGLcvqrbqLq0rkedlc8s0tkLDJm |
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,38 @@ | ||
const mongoose = require("mongoose"); | ||
const User = require("../schema/user"); | ||
const express = require('express'); | ||
const cors = require('cors'); | ||
|
||
// Middleware | ||
const app = express(); | ||
app.use(cors()); | ||
app.use(express.json()); | ||
|
||
require('dotenv').config(); | ||
|
||
// API call to create new object | ||
const getProfilePic = async (req, res) => { | ||
try { | ||
// Using the passed from front-end object | ||
const passedUser = req.body; | ||
|
||
const user = await User.findOne({ | ||
anon_username: passedUser.username | ||
}); | ||
|
||
if (!user) { | ||
return res.status(401).json({errorMsg : "Unable to find user"}); | ||
} | ||
|
||
console.log(user.anon_username); | ||
console.log(user.avatar); | ||
|
||
// Send tokens to the frontend | ||
res.status(200).json({profilePic: user.avatar}); | ||
|
||
} catch (error) { | ||
res.status(500).send('Error getting profile pic: ' + error.message); | ||
} | ||
}; | ||
|
||
module.exports = getProfilePic; |
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,24 @@ | ||
const Resume = require('../schema/resume'); | ||
const Comment = require('../schema/comments'); | ||
|
||
// API call to fetch resumes with comments for a specific user | ||
const getUserResumesAndComments = async (req, res) => { | ||
try { | ||
const userId = req.params.userId; | ||
const resumes = await Resume.find({ uploader_id: userId }).populate('uploader_id'); | ||
|
||
const resumesWithComments = await Promise.all(resumes.map(async (resume) => { | ||
const comments = await Comment.find({ resumeId: resume._id }); | ||
return { | ||
...resume.toObject(), | ||
comments | ||
}; | ||
})); | ||
|
||
res.json(resumesWithComments); | ||
} catch (error) { | ||
res.status(500).json({ error: 'Error fetching resumes with comments' }); | ||
} | ||
}; | ||
|
||
module.exports = getUserResumesAndComments; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const mongoose = require("mongoose"); | ||
const User = require('../schema/user'); | ||
const express = require('express'); | ||
const cors = require('cors'); | ||
|
||
// Middleware | ||
const app = express(); | ||
app.use(cors()); | ||
app.use(express.json()); | ||
|
||
const setProfilePic = async (req, res) => { | ||
try { | ||
const passedInfo = req.body; | ||
|
||
// Mark all messages from another person as read | ||
await User.updateOne( | ||
{ anon_username: passedInfo.username }, | ||
{ $set: { avatar: passedInfo.filename } } | ||
); | ||
|
||
return res.status(200).json({ message: "updated"}); | ||
|
||
} catch (error) { | ||
return res.status(500).json({ message: error.message, isValid: false }); | ||
} | ||
}; | ||
|
||
module.exports = setProfilePic; |
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,7 @@ | ||
const Filter = require('bad-words'); | ||
const filter = new Filter(); | ||
const customWords = ['stupid', 'idiot', 'dumb', 'crazy','hate','bad','horrible','terrible']; // Add more as needed | ||
filter.addWords(...customWords) | ||
const isBad = (text) => filter.isProfane(text); | ||
|
||
module.exports = isBad; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -14,6 +14,7 @@ const getUserResumes = require('./API/getUserResumes'); | |
const displayResumes = require('./API/displayResumes'); | ||
const deleteResumes = require('./API/deleteResumes'); | ||
const updateResumePublicStatus = require('./API/updateResume'); | ||
const getUserResumesAndComments = require('./API/getUserResumesAndComments'); | ||
const getSwipingResumes = require('./API/getSwipingResumes'); | ||
const addSwipe = require('./API/addSwipe'); | ||
const checkMatch = require('./API/checkMatch'); | ||
|
@@ -38,6 +39,10 @@ const getUploaderName = require('./API/getUserName'); | |
const updateDmStatus = require('./API/updateDmStatus'); | ||
const getDmStatus = require('./API/getDmStatus'); | ||
|
||
// Profile pic API's | ||
const setProfilePic = require('./API/setProfilePic'); | ||
const getProfilePic = require('./API/getProfilePic'); | ||
|
||
require('dotenv').config(); | ||
|
||
const MONGO_DB = "mongodb+srv://Cluster20901:[email protected]/linkup?retryWrites=true&w=majority&appName=Cluster20901"; | ||
|
@@ -124,6 +129,7 @@ conn.once('open', () => { | |
// RESUMES | ||
app.post('/upload', upload.single('file'), uploadResumes); | ||
app.get('/resumes/:userId', getUserResumes); | ||
app.get('/resumes/:userId/reviewed', getUserResumesAndComments); // Update route to use the new handler | ||
app.get('/bucket/files/:filename', displayResumes(gfsBucket)); | ||
app.post('/delete-resumes', deleteResumes(gfsBucket)); | ||
app.post('/api/update-resume', updateResumePublicStatus); | ||
|
@@ -187,6 +193,9 @@ app.get('/api/get-uploader-name/:userId', getUploaderName); | |
// app.use('/api/resume', addComments); | ||
// app.use('/api/resume', getComments); | ||
|
||
// Profile Pics | ||
app.post('/set-profile-pic', setProfilePic); | ||
app.post('/get-profile-pic', getProfilePic); | ||
|
||
// Listening on Port 3001 | ||
const PORT = 3001; | ||
|
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Oops, something went wrong.