-
Notifications
You must be signed in to change notification settings - Fork 31
Kai/switch to react query #565
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
Scr4tch587
wants to merge
8
commits into
main
Choose a base branch
from
kai/switch-to-react-query
base: main
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.
Open
Changes from 3 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
4cf9bab
First version of MCC, needs debugging
Scr4tch587 69a957b
React query in MCC and test endpoints
Scr4tch587 7a755c4
merging divergent branches
Scr4tch587 ef110e9
Implemented react-query in ARO, PR feedback, removed test endpoints
Scr4tch587 2ac63e2
Fixing last commit
Scr4tch587 f8993b6
Removing test endpoints
Scr4tch587 21ef4dc
Fixing git build ARO check
Scr4tch587 1ac81ee
Merging origin main into working branch
Scr4tch587 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file not shown.
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,39 @@ | ||
| from fastapi import APIRouter | ||
| from pydantic import BaseModel | ||
|
|
||
| aro_requests_router = APIRouter(tags=["MCC", "ARO Requests"]) | ||
|
|
||
|
|
||
| class AROItem(BaseModel): | ||
| """ | ||
| Represents an ARO request item with location and status. | ||
|
|
||
| Attributes: | ||
| id (int): Unique identifier of the ARO request. | ||
| latitude (float): Latitude of the request location. | ||
| longitude (float): Longitude of the request location. | ||
| status (str): Status of the request. | ||
| """ | ||
|
|
||
| id: int | ||
| latitude: float | ||
| longitude: float | ||
| status: str | ||
|
|
||
|
|
||
| hardcoded_aro_requests = [ | ||
| {"id": 1, "latitude": 43.468, "longitude": -80.540, "status": "pending"}, | ||
| {"id": 2, "latitude": 43.471, "longitude": -80.544, "status": "complete"}, | ||
| {"id": 3, "latitude": 43.473, "longitude": -80.539, "status": "in-progress"}, | ||
| ] | ||
|
|
||
|
|
||
| @aro_requests_router.get("/", response_model=list[AROItem]) | ||
| async def get_aro_requests() -> list[AROItem]: | ||
| """ | ||
| Retrieve the hardcoded ARO requests for MCC frontend testing. | ||
|
|
||
| Returns: | ||
| List[AROItem]: A list of all hardcoded ARO requests. | ||
| """ | ||
| return hardcoded_aro_requests |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| from datetime import datetime | ||
|
|
||
| from fastapi import APIRouter | ||
| from pydantic import BaseModel | ||
|
|
||
| logs_router = APIRouter(tags=["Logs"]) | ||
|
|
||
|
|
||
| class LogItem(BaseModel): | ||
| """ | ||
| Represents a log item with date and message. | ||
|
|
||
| Attributes: | ||
| date (datetime): Time that the messaged was logged. | ||
| log (str): Information that was logged | ||
| """ | ||
|
|
||
| date: datetime | ||
| log: str | ||
|
|
||
|
|
||
| # Example hardcoded logs | ||
| hardcoded_logs = [ | ||
| {"date": "2025-09-28 10:05:00", "log": "ARO request received."}, | ||
| {"date": "2025-09-28 10:10:00", "log": "Mission Command request received"}, | ||
| ] | ||
|
|
||
|
|
||
| @logs_router.get("/", response_model=list[LogItem]) | ||
| async def get_recent_logs() -> list[LogItem]: | ||
| """ | ||
| Gets the hardcoded test logs for MCC frontend testing | ||
|
|
||
| :return: list of logs | ||
| """ | ||
| return hardcoded_logs |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| from fastapi import APIRouter | ||
| from pydantic import BaseModel | ||
|
|
||
| mission_commands_router = APIRouter(tags=["Mission Control"]) | ||
|
|
||
|
|
||
| class MissionCommandRequest(BaseModel): | ||
| """ | ||
| Represents a body for a mission command request | ||
|
|
||
| Attributes: | ||
| command (str): Title of the command request. | ||
| """ | ||
|
|
||
| command: str | ||
|
|
||
|
|
||
| class MissionCommandResponse(BaseModel): | ||
| """ | ||
| Represents a body for a mission command response | ||
|
|
||
| Attributes: | ||
| response (str): Response message. | ||
| """ | ||
|
|
||
| response: str | ||
|
|
||
|
|
||
| @mission_commands_router.post("/", response_model=MissionCommandResponse) | ||
| async def execute_mission_command(cmd: MissionCommandRequest) -> MissionCommandResponse: | ||
| """ | ||
| Gets the hardcoded mission command response for MCC frontend testing | ||
|
|
||
| :return: mission command respone | ||
| """ | ||
| return MissionCommandResponse(response=f"Executed command: {cmd.command}") |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
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.
I think you should remove these print statements since they seem to be for debugging