feat: added put endpoint to update api status by api_group#1167
Open
Mukeli3 wants to merge 23 commits intohngprojects:devfrom
Open
feat: added put endpoint to update api status by api_group#1167Mukeli3 wants to merge 23 commits intohngprojects:devfrom
Mukeli3 wants to merge 23 commits intohngprojects:devfrom
Conversation
Signed-off-by: Continuum <113690025+Mukeli3@users.noreply.github.com>
Signed-off-by: Continuum <113690025+Mukeli3@users.noreply.github.com>
Contributor
|
Drop a screenshot confirming your tests are passing including past tests |
Author
|
I'm on it |
samuelogboye
approved these changes
Mar 2, 2025
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 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: