-
Notifications
You must be signed in to change notification settings - Fork 213
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
feat: create feature request api endpoint #1204
base: dev
Are you sure you want to change the base?
Conversation
…ate_python_fastapi_web into dev feat: implement feature requests api
…re request endpoints - Fixed mock setups for `create_feature_request`, `get_feature_requests`, and related functions to ensure proper calls. - Reordered authorization checks to prioritize "not found" checks before "forbidden" checks. - Corrected mock mismatches in `get_feature_request_success_admin` and other tests. - Improved test assertions and coverage for error cases (404, 403) and success scenarios.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove all these pictures i am seeing here
There are other ways to upload a picture into your PR
Signed-off-by: DanielleBadobre <[email protected]>
Signed-off-by: DanielleBadobre <[email protected]>
done ✅ |
Signed-off-by: DanielleBadobre <[email protected]>
Signed-off-by: DanielleBadobre <[email protected]>
…hemas Signed-off-by: DanielleBadobre <[email protected]>
- Modify fixtures to remove status from feature request creation data - Add tests to verify status is always set to "Pending" on creation - Add test cases covering admin-only status update restriction - Ensure non-admin users can still update other fields - Fix capitalization of priority values to match model defaults Signed-off-by: DanielleBadobre <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolve that change and we are GTG
if not current_user.is_superadmin and "status" in update_data: | ||
raise HTTPException( | ||
status_code=status.HTTP_403_FORBIDDEN, | ||
detail="Only admins can update the status field" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Youve already made a check to verify admin access in line 89
these lines of code will never be reached.
You can remove it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok sir, but actually the two checks serve different purposes.
-
The first check (line 89) verifies if the user has permission to update the feature request at all. It checks if the user is either a superadmin OR the owner of the feature request.
-
The second check (lines 98-102) only applies when a user is trying to update the "status" field. Even if a user passes the first check (because they're the owner of the request), they'll still hit this second check if they're trying to update the status field.
should i still remove the lines ?
FEATURE REQUESTS API
Description
Implemented feature request functionality, including:
Related Issue (Link to issue ticket)
#1191
Motivation and Context
This feature enables users to request new functionalities directly from the application while ensuring that only authorized users can view, update, or delete their own requests. Superadmins have access to all feature requests.
How Has This Been Tested?
Screenshots (Postman, etc):
Pytest Results
Creating Feature Request
Getting User's Features Requests
Getting Feature Request by ID
Updating Feature Request
Deleting Feature Request
Accessing Deleted Feature Request
Types of changes
Checklist: