website-backend icon indicating copy to clipboard operation
website-backend copied to clipboard

feat: add purpose field and make discord invite API be able to generate invites n times by superusers

Open devdeadviz opened this issue 1 year ago • 8 comments

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 flag Screenshot 2024-10-19 at 2 25 57 AM

With a feature flag (When user doesn't have invite link already created.) image

With a feature flag (When the user already has an invite link.) image

Test Coverage

Unit Tests Screenshots

image

image

Integration Tests Screenshots Screenshot 2024-11-05 at 12 42 41 AM Screenshot 2024-11-05 at 12 39 50 AM

Additional Notes

devdeadviz avatar Oct 18 '24 21:10 devdeadviz

Please add proper test coverage of the file you changed

vinit717 avatar Nov 04 '24 19:11 vinit717

Please add proper test coverage of the file you changed

Done

devdeadviz avatar Nov 04 '24 19:11 devdeadviz

How are you passing the user ID in the query params?

vinit717 avatar Nov 05 '24 18:11 vinit717

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.

devdeadviz avatar Nov 05 '24 18:11 devdeadviz

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?

vinit717 avatar Nov 05 '24 18:11 vinit717

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.

devdeadviz avatar Nov 05 '24 19:11 devdeadviz

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 userId? how did you know the userId and which userId to pass?

vinit717 avatar Nov 05 '24 19:11 vinit717

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 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.

devdeadviz avatar Nov 05 '24 19:11 devdeadviz