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

fix: send conflict response when user has a pending request #2339

Merged

Conversation

pankajjs
Copy link
Member

@pankajjs pankajjs commented Jan 8, 2025

Date: 8 Jan, 2025

Developer Name: @pankajjs


Issue Ticket Number

Description

This PR fixes the error response when a user has a pending request and try to create another request.

Documentation Updated?

  • Yes
  • No

Under Feature Flag

  • Yes
  • No

Database Changes

  • Yes
  • No

Breaking Changes

  • Yes
  • No

Development Tested?

  • Yes
  • No

Screenshots

Screenshot 1

Test Coverage

Screenshot 1

Additional Notes

@pankajjs pankajjs changed the title fix: Changed status code to 409 for sending Conflict response fix: send conflict response when user has a pending request Jan 8, 2025
@AnujChhikara
Copy link
Member

LGTM

@iamitprakash iamitprakash merged commit 5c80de0 into Real-Dev-Squad:develop Jan 9, 2025
3 checks passed
iamitprakash pushed a commit that referenced this pull request Jan 11, 2025
* feat: Add api to create onboarding extension request from discord server (#2307)

* fix:added onboarding type in request

* feat: added types for onboarding extension request

* feat: added validator and skip-authenticate middleware

* fix: added missing field in user type

* feat: added controller for handling the create onboarding extension request feature

* fix: remove requestedBy field because validation for super-users is done before hitting this api

* refactor: moved constant messages from controller

* fix: remove super-users validation check as it is done before making this api call

* fix: create newEndsOn from current date when deadline has missed

* fix: wrap schema validation logic in try-catch block

* chore: refactor varibale name for better readability

* chore: refactor new deadline calculation logic in a separate utils file for reuse

* chore: use utils function to calculate days to milliseconds

* feat: added utils function to validate date

* fix: return error response for invalid date

* fix: return forbidden response for non-onboarding user

* chore: added semicolon for consistent code practise

* chore: added jsDoc for functions and refactor import statment

* fix: import addLog from service file and fix lint issue

* Add tests for create onboarding extension request api (#2306)

* feat: added tests for middlewares

* feat:added tests for controller

* refactor: create middleware in beforeEach hook

* refactor: remove requestBy field and super-users validation tests

* fix: expectation message as test was failing

* fix: change order of middleware creation as test was failing

* fix: assert statement and mock value

* feat: added tests for handling edges cases and fixed existing test

* chore: correct test name

* chore: fix lint issue

* feat: Integrate userData into Progresses API to reduce redundant calls (#2311)

* initial

* fix typos

* using batches to fetch userIds

* refactor the function

* added test for dev false case

* added unit tests

* fix response body containing email

---------

Co-authored-by: Achintya Chatterjee <55826451+Achintya-Chatterjee@users.noreply.github.com>
Co-authored-by: Prakash Choudhary <34452139+prakashchoudhary07@users.noreply.github.com>

* fix: Changed status code to 409 for sending Conflict response (#2339)

* chore(#2342) - upgraded dependency packages

* Revert "chore(#2342) - upgraded dependency packages" (#2343)

This reverts commit 5bc49c6.

---------

Co-authored-by: Pankaj <pankajshadev@gmail.com>
Co-authored-by: Anuj Chhikara <107175639+AnujChhikara@users.noreply.github.com>
Co-authored-by: Prakash Choudhary <34452139+prakashchoudhary07@users.noreply.github.com>
Co-authored-by: Vikas Singh <59792866+vikasosmium@users.noreply.github.com>
Co-authored-by: Yash Raj <56453897+yesyash@users.noreply.github.com>
@Achintya-Chatterjee Achintya-Chatterjee mentioned this pull request Jan 15, 2025
10 tasks
yesyash added a commit that referenced this pull request Jan 18, 2025
* Dev to Main Sync  (#2336)

* feat: Add api to create onboarding extension request from discord server (#2307)

* fix:added onboarding type in request

* feat: added types for onboarding extension request

* feat: added validator and skip-authenticate middleware

* fix: added missing field in user type

* feat: added controller for handling the create onboarding extension request feature

* fix: remove requestedBy field because validation for super-users is done before hitting this api

* refactor: moved constant messages from controller

* fix: remove super-users validation check as it is done before making this api call

* fix: create newEndsOn from current date when deadline has missed

* fix: wrap schema validation logic in try-catch block

* chore: refactor varibale name for better readability

* chore: refactor new deadline calculation logic in a separate utils file for reuse

* chore: use utils function to calculate days to milliseconds

* feat: added utils function to validate date

* fix: return error response for invalid date

* fix: return forbidden response for non-onboarding user

* chore: added semicolon for consistent code practise

* chore: added jsDoc for functions and refactor import statment

* fix: import addLog from service file and fix lint issue

* Add tests for create onboarding extension request api (#2306)

* feat: added tests for middlewares

* feat:added tests for controller

* refactor: create middleware in beforeEach hook

* refactor: remove requestBy field and super-users validation tests

* fix: expectation message as test was failing

* fix: change order of middleware creation as test was failing

* fix: assert statement and mock value

* feat: added tests for handling edges cases and fixed existing test

* chore: correct test name

* chore: fix lint issue

* feat: Integrate userData into Progresses API to reduce redundant calls (#2311)

* initial

* fix typos

* using batches to fetch userIds

* refactor the function

* added test for dev false case

* added unit tests

* fix response body containing email

---------

Co-authored-by: Achintya Chatterjee <55826451+Achintya-Chatterjee@users.noreply.github.com>
Co-authored-by: Prakash Choudhary <34452139+prakashchoudhary07@users.noreply.github.com>

* fix: Changed status code to 409 for sending Conflict response (#2339)

* chore(#2342) - upgraded dependency packages

* Revert "chore(#2342) - upgraded dependency packages" (#2343)

This reverts commit 5bc49c6.

---------

Co-authored-by: Pankaj <pankajshadev@gmail.com>
Co-authored-by: Anuj Chhikara <107175639+AnujChhikara@users.noreply.github.com>
Co-authored-by: Prakash Choudhary <34452139+prakashchoudhary07@users.noreply.github.com>
Co-authored-by: Vikas Singh <59792866+vikasosmium@users.noreply.github.com>
Co-authored-by: Yash Raj <56453897+yesyash@users.noreply.github.com>

* fix: merge conflicts

---------

Co-authored-by: Amit Prakash <34869115+iamitprakash@users.noreply.github.com>
Co-authored-by: Pankaj <pankajshadev@gmail.com>
Co-authored-by: Anuj Chhikara <107175639+AnujChhikara@users.noreply.github.com>
Co-authored-by: Prakash Choudhary <34452139+prakashchoudhary07@users.noreply.github.com>
Co-authored-by: Vikas Singh <59792866+vikasosmium@users.noreply.github.com>
Co-authored-by: Yash Raj <56453897+yesyash@users.noreply.github.com>
yesyash added a commit that referenced this pull request Jan 18, 2025
* Dev to Main Sync  (#2336)

* feat: Add api to create onboarding extension request from discord server (#2307)

* fix:added onboarding type in request

* feat: added types for onboarding extension request

* feat: added validator and skip-authenticate middleware

* fix: added missing field in user type

* feat: added controller for handling the create onboarding extension request feature

* fix: remove requestedBy field because validation for super-users is done before hitting this api

* refactor: moved constant messages from controller

* fix: remove super-users validation check as it is done before making this api call

* fix: create newEndsOn from current date when deadline has missed

* fix: wrap schema validation logic in try-catch block

* chore: refactor varibale name for better readability

* chore: refactor new deadline calculation logic in a separate utils file for reuse

* chore: use utils function to calculate days to milliseconds

* feat: added utils function to validate date

* fix: return error response for invalid date

* fix: return forbidden response for non-onboarding user

* chore: added semicolon for consistent code practise

* chore: added jsDoc for functions and refactor import statment

* fix: import addLog from service file and fix lint issue

* Add tests for create onboarding extension request api (#2306)

* feat: added tests for middlewares

* feat:added tests for controller

* refactor: create middleware in beforeEach hook

* refactor: remove requestBy field and super-users validation tests

* fix: expectation message as test was failing

* fix: change order of middleware creation as test was failing

* fix: assert statement and mock value

* feat: added tests for handling edges cases and fixed existing test

* chore: correct test name

* chore: fix lint issue

* feat: Integrate userData into Progresses API to reduce redundant calls (#2311)

* initial

* fix typos

* using batches to fetch userIds

* refactor the function

* added test for dev false case

* added unit tests

* fix response body containing email

---------

Co-authored-by: Achintya Chatterjee <55826451+Achintya-Chatterjee@users.noreply.github.com>
Co-authored-by: Prakash Choudhary <34452139+prakashchoudhary07@users.noreply.github.com>

* fix: Changed status code to 409 for sending Conflict response (#2339)

* chore(#2342) - upgraded dependency packages

* Revert "chore(#2342) - upgraded dependency packages" (#2343)

This reverts commit 5bc49c6.

---------

Co-authored-by: Pankaj <pankajshadev@gmail.com>
Co-authored-by: Anuj Chhikara <107175639+AnujChhikara@users.noreply.github.com>
Co-authored-by: Prakash Choudhary <34452139+prakashchoudhary07@users.noreply.github.com>
Co-authored-by: Vikas Singh <59792866+vikasosmium@users.noreply.github.com>
Co-authored-by: Yash Raj <56453897+yesyash@users.noreply.github.com>

* fix: merge conflicts

---------

Co-authored-by: Amit Prakash <34869115+iamitprakash@users.noreply.github.com>
Co-authored-by: Pankaj <pankajshadev@gmail.com>
Co-authored-by: Anuj Chhikara <107175639+AnujChhikara@users.noreply.github.com>
Co-authored-by: Prakash Choudhary <34452139+prakashchoudhary07@users.noreply.github.com>
Co-authored-by: Vikas Singh <59792866+vikasosmium@users.noreply.github.com>
Co-authored-by: Yash Raj <56453897+yesyash@users.noreply.github.com>
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.

Feature : Extend Onboarding Override for Discord Server
3 participants