Skip to content

feat: add questions API with tests#1711

Merged
iamitprakash merged 27 commits intodevelopfrom
feat/questions-answers-api
Jan 4, 2024
Merged

feat: add questions API with tests#1711
iamitprakash merged 27 commits intodevelopfrom
feat/questions-answers-api

Conversation

@satyam73
Copy link
Contributor

@satyam73 satyam73 commented Nov 22, 2023

Date: 25-12-2023

Developer Name: Satyam Bajpai


Issue Ticket Number:-

Description:

This PR contains questions API which will be needed for word cloud feature. The get request is server sent event API that's why you wil see the code little different from normal API.

Usage

This API will be used in live-site question answers where host can ask question to connected peers in realtime and connected peers and answer the question in realtime and the approved responses will be used to form word cloud in realtime in every clients screen.

Sequence diagram - https://lucid.app/lucidspark/02e146bd-6d0f-4d4e-a425-f811c9289e49/edit?viewport_loc=-5030%2C-192%2C3515%2C2201%2C0_0&invitationId=inv_4a2f8f42-57df-473f-86a1-caea4c57d619
API contracts - RealDevSquad/website-api-contracts#166
The test for SSE API is not written in this PR I will handle this in the ticket mentioned below,

Is Under Feature Flag

  • Yes
  • No

Database changes

  • Yes
  • No

Breaking changes (If your feature is breaking/missing something please mention pending tickets)

  • Yes
  • No

Is Development Tested?

  • Yes
  • No

Tested in staging?

  • Yes
  • No

Add relevant Screenshot below ( e.g test coverage etc. )

image

questions models test coverage
image
questions controllers test

image

Get API /questions initial null data response

image

Post API /questions without max_characters

image

Post API /questions with max_characters

image

Question pushed when post request /questions done

Note: Feature flag is added on frontend and this API is newly created so that's why haven't added on backend.


router.post(
"/",
authenticate,

Check failure

Code scanning / CodeQL

Missing rate limiting

This route handler performs [authorization](1), but is not rate-limited. This route handler performs [authorization](2), but is not rate-limited. This route handler performs [authorization](3), but is not rate-limited.
@satyam73 satyam73 marked this pull request as ready for review December 25, 2023 08:56
@satyam73 satyam73 changed the title feat: add post api of questions with tests feat: add questions API with tests Dec 25, 2023
ajoykumardas12
ajoykumardas12 previously approved these changes Dec 27, 2023
@Ajeyakrishna-k
Copy link
Contributor

  • Can you please add a description regarding how these APIs are going to be used?
  • Could you provide a sequence diagram, or a link to a design doc?

@satyam73
Copy link
Contributor Author

  • Can you please add a description regarding how these APIs are going to be used?
  • Could you provide a sequence diagram, or a link to a design doc?

Updated the description

@sahsisunny
Copy link
Contributor

Can you mention the PR for data models and api contracts?

sahsisunny
sahsisunny previously approved these changes Dec 28, 2023
@sahsisunny sahsisunny dismissed their stale review December 28, 2023 12:18

Approve by mistake

@sahsisunny
Copy link
Contributor

All Typescript codes are written in strict mode?

@satyam73
Copy link
Contributor Author

ll Typescript codes are written in strict mode?

didn't get this one

sahsisunny
sahsisunny previously approved these changes Dec 29, 2023
Copy link
Contributor

@Ajeyakrishna-k Ajeyakrishna-k left a comment

Choose a reason for hiding this comment

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

Can you please help me understand how will this work for the following cases:

  • When there are more than one event happening simultaneously.
  • If we have deployed more than one instances of our server.

@satyam73
Copy link
Contributor Author

Can you please help me understand how will this work for the following cases:

  • When there are more than one event happening simultaneously.
  • If we have deployed more than one instances of our server.

Currently as per requirements there will be only event that will happen at a time so it's build like that.

@Ajeyakrishna-k
Copy link
Contributor

Can you please help me understand how will this work for the following cases:

  • When there are more than one event happening simultaneously.
  • If we have deployed more than one instances of our server.

Currently as per requirements there will be only event that will happen at a time so it's build like that.

Can you add a comments with link to detailed ticket explaining these limitations

@satyam73
Copy link
Contributor Author

satyam73 commented Jan 2, 2024

Can you please help me understand how will this work for the following cases:

  • When there are more than one event happening simultaneously.
  • If we have deployed more than one instances of our server.

Currently as per requirements there will be only event that will happen at a time so it's build like that.

Can you add a comments with link to detailed ticket explaining these limitations

Created a wiki page for the overall feature and added the limitations in it here - https://github.com/Real-Dev-Squad/website-www/wiki/%5BFeature%5D-%E2%80%90-Realtime-Word-Cloud-Questions-Answers-Feature

@Ajeyakrishna-k
Copy link
Contributor

Can you please help me understand how will this work for the following cases:

  • When there are more than one event happening simultaneously.
  • If we have deployed more than one instances of our server.

Currently as per requirements there will be only event that will happen at a time so it's build like that.

Can you add a comments with link to detailed ticket explaining these limitations

Created a wiki page for the overall feature and added the limitations in it here - https://github.com/Real-Dev-Squad/website-www/wiki/%5BFeature%5D-%E2%80%90-Realtime-Word-Cloud-Questions-Answers-Feature

Please add this link in comments on clients array and questions api routes.

@iamitprakash iamitprakash merged commit b7ea59d into develop Jan 4, 2024
@iamitprakash iamitprakash deleted the feat/questions-answers-api branch January 4, 2024 07:46
@satyam73 satyam73 self-assigned this Jan 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants