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

Jatin create a function to send email to user's who completed hours but missed summary #1104

Open
wants to merge 6 commits into
base: development
Choose a base branch
from

Conversation

JatinAgrawal94
Copy link
Contributor

@JatinAgrawal94 JatinAgrawal94 commented Sep 15, 2024

Description

Screenshot 2024-09-08 at 1 42 24 PM

Related PRS (if any):

To test this backend PR you need to checkout the dev branch in frontend .

Main changes explained:

  • Created a function completeHoursAndMissedSummary in src/helpers/userHelper.js
  • Added a CronJob in src/cronjobs/userProfileJobs.js

##Before Testing
To send an email using the Gmail API with OAuth2 and nodemailer, follow the video below and set it up.
https://www.youtube.com/watch?v=-rcRf7yswfM&t=10s&ab_channel=MafiaCodes

Fill in the these variable values from the above setup in the .env file of the backend.
REACT_APP_EMAIL =
REACT_APP_EMAIL_CLIENT_ID =
REACT_APP_EMAIL_CLIENT_SECRET =
REACT_APP_EMAIL_REFRESH_TOKEN =
REACT_APP_EMAIL_CLIENT_REDIRECT_URI = https://developers.google.com/oauthplayground

How to test:

  1. check into current branch
  2. do npm install and npm run build to run this PR locally
  3. Go to src/server.js. Import completeHoursandMissedSummary and call the function as described in the image below.
  4. Go to src/helpers/userHelper.js. Find completeHoursandMissedSummary.
  5. Replace the recipient email where the emailSender function is called with your email which you have access to (To avoid sending emails to other users).
  6. Enter a console statement in the if statement enclosing the emailSender function, so one can know when a user is found and email has been sent.
  7. Note: The code may take some time to send an email as it checks all user's who have completed their hours but missed their summary.

Frontend Repository

  1. Log in as owner/admin any user.
  2. Add hours which are equivalent to total hours as intangible time. Select them as tangible.
  3. Make sure the summary is not submitted.

Screenshots or videos of changes:

Screenshot 2024-09-14 at 5 25 48 PM
email-send.mp4

@chu-ziyu chu-ziyu self-requested a review September 20, 2024 00:07
Copy link

@chu-ziyu chu-ziyu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @JatinAgrawal94 ,
Thank you for the great instructional video on setting up the Gmail API with OAuth. After following all the steps and completing the testing, I can see console logs in the terminal, but nothing is sent to my inbox. I’m not sure if I missed something. I’d appreciate any guidance you can offer and feel free to reach out anytime for further discussion.
Screenshot 2024-09-19 at 4 38 09 PM
Screenshot 2024-09-19 at 4 51 25 PM
Screenshot 2024-09-19 at 4 54 10 PM
Screenshot 2024-09-19 at 4 55 22 PM

@Hritvik111 Hritvik111 added the High Priority - Please Review First This is an important PR we'd like to get merged as soon as possible label Oct 9, 2024
@Anoushka21 Anoushka21 assigned Anoushka21 and unassigned Anoushka21 Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
High Priority - Please Review First This is an important PR we'd like to get merged as soon as possible
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants