-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #963 from hngprojects/dev
chore: Merge dev branch into staging branch.
- Loading branch information
Showing
35 changed files
with
8,636 additions
and
263 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from sqlalchemy import Column, DateTime, String, Text, Numeric, func | ||
from api.v1.models.base_model import BaseTableModel | ||
|
||
class APIStatus(BaseTableModel): | ||
__tablename__ = "api_status" | ||
|
||
api_group = Column(String, nullable=False) | ||
status = Column(String, nullable=False) | ||
last_checked = Column(DateTime(timezone=True), server_default=func.now(), onupdate=func.now()) | ||
response_time = Column(Numeric, nullable=True) | ||
details = Column(Text, nullable=True) |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
from typing import Annotated | ||
from api.db.database import get_db | ||
from api.v1.schemas.api_status import APIStatusPost | ||
from api.v1.services.api_status import APIStatusService | ||
from api.utils.success_response import success_response | ||
from fastapi import APIRouter, Depends, status | ||
from sqlalchemy.orm import Session | ||
|
||
api_status = APIRouter(prefix='/api-status', tags=['API Status']) | ||
|
||
|
||
@api_status.get('', response_model=success_response, status_code=200) | ||
async def get_api_status(db: Annotated[Session, Depends(get_db)]): | ||
all_status = APIStatusService.fetch_all(db) | ||
|
||
return success_response( | ||
message='All API Status fetched successfully', | ||
data=all_status, | ||
status_code=status.HTTP_200_OK | ||
) | ||
|
||
|
||
@api_status.post('', response_model=success_response, status_code=201) | ||
async def post_api_status( | ||
schema: APIStatusPost, | ||
db: Annotated[Session, Depends(get_db)] | ||
): | ||
new_status = APIStatusService.upsert(db, schema) | ||
|
||
return success_response( | ||
message='API Status created successfully', | ||
data=new_status, | ||
status_code=status.HTTP_201_CREATED | ||
) |
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.