feat: add purpose field and make discord invite API be able to generate invites n times by superusers
Date: 19/10/2024
Developer Name: Kuldeep Gupta
Issue Ticket Number
This is a subtask for this issue https://github.com/Real-Dev-Squad/website-dashboard/issues/867
Description
I have refactored the discord invite API to add a purpose field along with a feature flag and also, the superuser can create n times discord invites.
Design Doc Link: https://docs.google.com/document/d/1kGOpNMBlRLJ7gARYv1kCOUaE3b96G5Y212IN05igJkc/edit?tab=t.0#heading=h.f040sbx0way2
Documentation Updated?
- [ ] Yes
- [x] No
Under Feature Flag
- [x] Yes
- [ ] No
Database Changes
- [x] Yes
- [ ] No
Breaking Changes
- [ ] Yes
- [x] No
Development Tested?
- [x] Yes
- [ ] No
Screenshots
Screenshot 1
Without a feature flagWith a feature flag (When user doesn't have invite link already created.)
With a feature flag (When the user already has an invite link.)
Test Coverage
Unit Tests Screenshots
Integration Tests Screenshots
Additional Notes
Please add proper test coverage of the file you changed
Please add proper test coverage of the file you changed
Done
How are you passing the user ID in the query params?
How are you passing the user ID in the query params?
@vinit717 I am not sure if I get your question properly, but the id is getting passed in this way /discord-actions/invite?userId=id.
How are you passing the user ID in the query params?
@vinit717 I am not sure if I get your question properly, but the id is getting passed in this way
/discord-actions/invite?userId=id.
How does this API get the userID from frontend?
How are you passing the user ID in the query params?
@vinit717 I am not sure if I get your question properly, but the id is getting passed in this way
/discord-actions/invite?userId=id.How does this API get the userID from frontend?
We need to pass the userId in the query params and we can read it in the code in this way const { userId } = req.query and use it in the API wherever we want to.
How are you passing the user ID in the query params?
@vinit717 I am not sure if I get your question properly, but the id is getting passed in this way
/discord-actions/invite?userId=id.How does this API get the userID from frontend?
We need to pass the userId in the query params and we can read it in the code in this way
const { userId } = req.queryand use it in the API wherever we want to.
How are you passing the userId? how did you know the userId and which userId to pass?
How are you passing the user ID in the query params?
@vinit717 I am not sure if I get your question properly, but the id is getting passed in this way
/discord-actions/invite?userId=id.How does this API get the userID from frontend?
We need to pass the userId in the query params and we can read it in the code in this way
const { userId } = req.queryand use it in the API wherever we want to.How are you passing the userId? how did you know the userId and which userId to pass?
I guess now I got your exact question, so for now we are not passing the userId from frontend. Right now the userId is getting used from superUser token.