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

Allow user to edit Extension Requests before approval #2215

Merged

Conversation

ahsrah7
Copy link
Contributor

@ahsrah7 ahsrah7 commented Oct 17, 2024

Date: 17-10-2024

Developer Name: Harshavardhan


Issue Ticket Number

Description

  • Allows user to edit an extension request if it is not yet approved.

Documentation Updated?

  • Yes
  • No

Under Feature Flag

  • Yes
  • No

Database Changes

  • Yes
  • No

Breaking Changes

  • Yes
  • No

Development Tested?

  • Yes
  • No

Screenshots

Screenshot 1
edit_er_before_approved.mp4

Test Coverage

Screenshot 1

image

image

Additional Notes

The skipAuthorizeRolesUnderFF & authorizeRoles middleware added to enable editing of Extension Request by normal user besides the other privileged users. The same is mention in the below issue created.

@pankajjs
Copy link
Contributor

pankajjs commented Oct 17, 2024

  1. There are no tests for disabled feature flag.
  2. Could you add the test coverage for you changes?

@ahsrah7
Copy link
Contributor Author

ahsrah7 commented Oct 17, 2024

  1. There are no tests for disabled feature flag.
  2. Could you add the test coverage for you changes?
  • will the tests for the feature flag not become the tests once feature flag is removed?
  • I have added the relevant test cases but if you have any specific cases please mention

@pankajjs
Copy link
Contributor

pankajjs commented Oct 18, 2024

  1. There are no tests for disabled feature flag.
  2. Could you add the test coverage for you changes?
  • will the tests for the feature flag not become the tests once feature flag is removed?
  • I have added the relevant test cases but if you have any specific cases please mention

@ahsrah7 I don't see any test when dev=false.

@ahsrah7
Copy link
Contributor Author

ahsrah7 commented Oct 18, 2024

  1. There are no tests for disabled feature flag.
  2. Could you add the test coverage for you changes?
  • will the tests for the feature flag not become the tests once feature flag is removed?
  • I have added the relevant test cases but if you have any specific cases please mention

@ahsrah7 I don't see any test when dev=false.

@pankajjs please let me know if I am getting this correctly. The existing flow where only super user can edit the ERs already has test cases. For the changes I have added where a normal user can also edit the ER until it is approved is under FF so have added tests accordingly. For the case which you are mentioning dev=false should be the test cases for the already existing flow which are already present. If I am missing anything please let me know.

@pankajjs
Copy link
Contributor

pankajjs commented Oct 18, 2024

As I see in updateExtensionRequest, you have introduced dev flag. When dev is false, you are returning res.boom.badRequest("Extension Request cannot be updated") this. But you have not written test for this.

@ahsrah7
Copy link
Contributor Author

ahsrah7 commented Oct 18, 2024

As I see in updateExtensionRequest, you have introduced dev flag. When dev is false, you are returning res.boom.badRequest("Extension Request cannot be updated") this. But you have not written test for this.

Yes I have introduced the dev flag but when dev flag is false the control does not reach the updateExtensionRequest at all. But thanks for raising this I notice that string type dev flag is always being type casted to true irrespective of the value provided in the query params.

routes/extensionRequests.js Dismissed Show dismissed Hide dismissed
@ahsrah7 ahsrah7 force-pushed the feature/edit-ER-before-approval branch from 38f3130 to 46bf763 Compare October 20, 2024 07:50
controllers/extensionRequests.js Outdated Show resolved Hide resolved
middlewares/skipAuthorizeRolesWrapper.js Outdated Show resolved Hide resolved
routes/extensionRequests.js Show resolved Hide resolved
@ahsrah7 ahsrah7 force-pushed the feature/edit-ER-before-approval branch from 46bf763 to 42d7eac Compare October 21, 2024 20:21
@ahsrah7 ahsrah7 force-pushed the feature/edit-ER-before-approval branch 2 times, most recently from 146bd21 to 7916d9e Compare November 20, 2024 17:13
@ahsrah7 ahsrah7 requested review from yesyash and vinit717 November 20, 2024 17:16
@iamitprakash iamitprakash merged commit b6351b7 into Real-Dev-Squad:develop Nov 25, 2024
3 checks passed
@ahsrah7 ahsrah7 mentioned this pull request Nov 26, 2024
10 tasks
listiclehub1 pushed a commit to listiclehub1/website-backend that referenced this pull request Dec 2, 2024
…#2215)

* added edit ability  for ER

* fixing function name and export type

* fix feature flag value check

* error message and status code updated

* middleware tests added

* pending status check added

* added comment regarding middleware for FF removal
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.

Allow Users to Edit Extension Requests Before Approval
6 participants