Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Haoji fetch profile images from team page and sending email for selecting correct images #608

Closed
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
11892e4
select profilePic as userProfile
juneluo Sep 15, 2023
ceee25f
add fecthUserProfilePics
Haoj1 Oct 21, 2023
f4c50d2
finish fetch the images from the website
Haoj1 Oct 22, 2023
b287f7b
Merge branch 'development' into Haoji-Make-App-Get-Profile-Images-fro…
Haoj1 Oct 28, 2023
6a0b2f5
update userProfileController.js
Haoj1 Oct 28, 2023
3079a32
add the feature into cronjob
Haoj1 Oct 29, 2023
31170e5
Merge branch 'Haoji-Make-App-Get-Profile-Images-from-Website' into Ha…
Haoj1 Nov 3, 2023
cf06d29
verify user is active and sending email
Haoj1 Nov 3, 2023
6f156c0
Merge branch 'development' into Haoji-alert-multiple-images-and-selec…
Haoj1 Nov 5, 2023
a28615c
sending email when multiple imgs
Haoj1 Nov 11, 2023
6564d20
Merge branch 'development' into Haoji-alert-multiple-images-and-selec…
Haoj1 Nov 11, 2023
07c10bf
update userhelper to send email
Haoj1 Nov 11, 2023
f9c15ed
update crawling proxy
Haoj1 Feb 3, 2024
84ac71b
update crawling proxy in backend
Haoj1 Feb 3, 2024
cdc2a5f
resolved conflict
Haoj1 Feb 4, 2024
be4bdc4
update cronjob period
Haoj1 Feb 4, 2024
d61d3bd
merge dev branch
Haoj1 Feb 17, 2024
5954590
Merge branch 'development' into Haoji-alert-multiple-images-and-selec…
Haoj1 Feb 20, 2024
f6999c1
remove email notification
Haoj1 Mar 3, 2024
d2c0241
Merge branch 'development' into Haoji-alert-multiple-images-and-selec…
Haoj1 Mar 3, 2024
84832b4
update profile api
Haoj1 Mar 22, 2024
82888e2
remove .DS_store
Haoj1 Mar 30, 2024
74723dc
resolve confilct with dev
Haoj1 Mar 30, 2024
8d49d43
add a error catch in profilecontroller
Haoj1 Mar 30, 2024
f2e39c5
resolved a conflict in cache
Haoj1 Apr 7, 2024
2770eff
fix the bug when there is same Last name case
Haoj1 Apr 13, 2024
7082779
resolved the conflict with dev
Haoj1 Apr 13, 2024
6c378cd
change cronjob frequency
Haoj1 Apr 13, 2024
9b6ac5b
fix package.json
Haoj1 Apr 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .DS_Store
Binary file not shown.
185 changes: 185 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@
"@babel/runtime": "^7.10.2",
"@sentry/node": "^5.17.0",
"async-exit-hook": "^2.0.1",
"axios": "^1.5.1",
"babel-plugin-module-resolver": "^5.0.0",
"bcryptjs": "^2.4.3",
"body-parser": "^1.18.3",
"cheerio": "^1.0.0-rc.12",
"cors": "^2.8.4",
"cron": "^1.8.2",
"dotenv": "^5.0.1",
Expand All @@ -65,6 +67,7 @@
"node-cache": "^5.1.2",
"node-datetime": "^2.0.3",
"nodemailer": "^6.4.16",
"playwright": "^1.39.0",
"redis": "^4.2.0",
"uuid": "^3.4.0",
"ws": "^8.8.1"
Expand Down
18 changes: 13 additions & 5 deletions src/controllers/userProfileController.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const userProfileController = function (UserProfile) {

UserProfile.find(
{},
'_id firstName lastName role weeklycommittedHours email permissions isActive reactivationDate createdDate endDate',
'_id firstName lastName profilePic storedPics role weeklycommittedHours email permissions isActive reactivationDate createdDate endDate',
)
.sort({
lastName: 1,
Expand Down Expand Up @@ -265,6 +265,7 @@ const userProfileController = function (UserProfile) {
firstName: up.firstName,
lastName: up.lastName,
email: up.email,
profilePic: up.profilePic,
};
const allUserCache = JSON.parse(cache.getCache('allusers'));
allUserCache.push(userCache);
Expand Down Expand Up @@ -303,12 +304,19 @@ const userProfileController = function (UserProfile) {
// validate userprofile pic

if (req.body.profilePic) {
const results = userHelper.validateProfilePic(req.body.profilePic);

if (!results.result) {
res.status(400).json(results.errors);
if (req.body.profilePic.startsWith('data:image/')) {
const results = userHelper.validateProfilePic(req.body.profilePic);
if (!results.result) {
res.status(400).json(results.errors);
return;
}
} else if (req.body.profilePic.startsWith( 'http://' ) || req.body.profilePic.startsWith( 'https://')) {

} else {
res.status(400).json({ error: 'Invalid profilePic format.' });
return;
}
record.storedPics = [];
}

const canEditTeamCode = req.body.requestor.role === 'Owner'
Expand Down
1 change: 1 addition & 0 deletions src/cronjobs/userProfileJobs.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const userProfileJobs = () => {
await userhelper.deleteBlueSquareAfterYear();
await userhelper.deleteExpiredTokens();
}
await userhelper.updateProfilesPic();
await userhelper.awardNewBadges();
await userhelper.reActivateUser();
await userhelper.deActivateUser();
Expand Down
Loading
Loading