-
Notifications
You must be signed in to change notification settings - Fork 214
feat: added put endpoint to update api status by api_group #1167
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
Open
Mukeli3
wants to merge
22
commits into
hngprojects:dev
Choose a base branch
from
Mukeli3:feat/extend-api-status
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
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
Signed-off-by: Continuum <[email protected]>
Signed-off-by: Continuum <[email protected]>
Drop a screenshot confirming your tests are passing including past tests |
I'm on it |
joboy-dev
requested changes
Mar 2, 2025
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.
Attend to the comment
samuelogboye
approved these changes
Mar 2, 2025
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 a new PUT /api-status/{api_group} endpoint to allow updating an existing API status record identified by api_group. The implementation includes:
Related Issue (Link to issue ticket)
#1063
Motivation and Context
This change is required to enhance the API status management system by allowing clients to update existing records rather than creating new ones. It solves the problem of duplicate entries cluttering the database and provides a more precise way to manage API status data. The feature is particularly useful for maintaining up-to-date status information (e.g., status, response_time, details, last_checked) for specific API groups, which is critical for monitoring and diagnostics.
How Has This Been Tested?
I tested the changes in a local development environment with the following setup:
Environment:
Ubuntu 20.04 (Vagrant), Python 3.10, FastAPI, SQLAlchemy, Supabase.
Steps:
curl -X PUT http://localhost:8000/api-status/user \ -H "Content-Type: application/json" \ -d '{"apiGroup": "user", "status": "active", "response_time": "200ms", "details": "API is running fine"}'
Got: 200 OK with updated data.
Partial update:
curl -X PUT http://localhost:8000/api-status/user \ -H "Content-Type: application/json" \ -d '{"status": "inactive"}'
Got: 200 OK with only status updated.
Non-existent api_group:
curl -X PUT http://localhost:8000/api-status/nonexistent \ -H "Content-Type: application/json" \ -d '{"status": "active"}'
Got: 404 Not Found.
Screenshots (if appropriate - Postman, etc):
Verified database updates using a SQL client (e.g., psql).
Results: All tests passed, with responses matching the specified formats (200 OK for success, 404 for not found).
Types of changes
Checklist: