Add profile management and single opportunity endpoints#340
Merged
WBroadwell merged 13 commits intoLabConnect-RCOS:Single-Opportunity-and-User-Profile-Managementfrom Oct 24, 2025
Merged
Conversation
new route that queries the database for all opportunities and returns them as a JSON list
test to ensure your new endpoint works correctly
creating a specific backend route to fetch the details of one opportunity by its ID
test verifies that the new endpoint correctly retrieves an opportunity or handle error
Added opportunity_to_dict helper Fix two GET endpoints for better error checks and improved data handling created corresponding tests in test_single_opportunity_routes.py for a smooth experience
GET /profile route to allow users to fetch their own profile data. Added a 'user_to_dict' helper function to consistently serialize user data.
PUT /profile route for user to update their personal details.
PUT /profile route for user to update their majors and department.
GET /profile endpoint: both successful data retrieval and unauthorized access PUT /profile endpoint: ensuring that full updates, partial updates, and unauthorized attempts are handled correctly. ISSUE: Login helper function to streamline authentication within the tests but the tests fail as user not in DB.
|
Here's the code health analysis summary for commits Analysis Summary
|
RafaelCenzano
requested changes
Oct 24, 2025
Member
RafaelCenzano
left a comment
There was a problem hiding this comment.
Make sure linting passes on changes. If you are using vscode you can use the ruff extension https://marketplace.visualstudio.com/items?itemName=charliermarsh.ruff. Or just call ruff directly as it should be installed.
Member
Author
|
@RafaelCenzano fixed the lint error |
62dab3c
into
LabConnect-RCOS:Single-Opportunity-and-User-Profile-Management
3 of 4 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This pull request introduces two major new features to the backend, complete with testing:
GET /opportunity/<int:opportunity_id>) to fetch all details for a single opportunity. This also includes helper functions to properly serialize the opportunity data for the JSON response.GET /profileandPUT /profile. These endpoints allow an authenticated user to fetch their own profile data and update it, including personal details (name, website, etc.) and their associated majors and departments.These changes provide the core API functionality needed for the frontend to build the individual opportunity view page and the user profile settings page.
Fixes # (issue)
(Please link the relevant issue number here, if one exists)
Type of change
How Has This Been Tested?
This PR has been tested by adding new unit test files for both major features:
Single Opportunity Endpoint:
test_opportunity.pyandtest_single_opportunity_routes.py.User Profile Management:
test_profile_routes.py, was created to provide full coverage for the new endpoints.GET /profilesuccess (for an authenticated user) and failure (for an unauthorized user).PUT /profilesuccess (for both full and partial data updates) and failure (for an unauthorized user).All new and existing unit tests pass locally with these changes. The User Profile Management is not fully passing, as the existing authentication code needs fixes.
Checklist: