codeuino / social-platform-donut-backend

Donut API:
http://donut-api-prod.codeuino.org/
GNU General Public License v3.0
24 stars 57 forks source link

done with invite link functionality #124

Closed Rupeshiya closed 4 years ago

Rupeshiya commented 4 years ago

name: Pull Request template about: Describe the PR. title: '' labels: '' assignees: ''


Problem

Github Issue Number: #123 The feature is not related to any problem but it's an extra feature that needs to be implemented. So the feature is if any user of the platform want to invite any other user which on the platform so they can invite through a link, which will be used by other to get registered as a user of the platform._

Solution of problem

One solution I can think of just generates the token using the senders token (use jsonwebtoken signed with the expiry time and sender's token). Now when the user who is invited will receive the link, let say: http://localhost:5000/invite/${token} and the link is clicked then a GET the request will be sent to the server so will catch that request and then in that request in the backend decode that token and check user collections if that user exists i.e sender and the token is not expired then it's valid invitation so now directly redirect the invitation receiver to the register page else send the message that invitation is not valid.

Type of Change

[ ] Bug fix [✓] New Feature [ ] Development of UI/UX prototypes [✓ ] Small refactor [ ] Change in Documentation

Checklist

[✓] My code follows the same style as the codebase [ ] My Code change requires a change in documentation [ ] I have updated the Readme accordingly [✓] I made PR against development branch [✓] I have run the test cases locally and it's passing. [✓] I have squashed my commits

codecov[bot] commented 4 years ago

Codecov Report

Merging #124 into development will increase coverage by 1.21%. The diff coverage is 93.33%.

Impacted file tree graph

@@               Coverage Diff               @@
##           development     #124      +/-   ##
===============================================
+ Coverage        67.63%   68.85%   +1.21%     
===============================================
  Files               26       26              
  Lines              689      687       -2     
  Branches            94       94              
===============================================
+ Hits               466      473       +7     
+ Misses             199      191       -8     
+ Partials            24       23       -1     
Impacted Files Coverage Δ
app/controllers/user.js 61.25% <92.30%> (+11.25%) :arrow_up:
app/routes/user.js 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update db5ccda...d13e12d. Read the comment docs.