init
This commit is contained in:
commit
cb3743dbe8
59 changed files with 21340 additions and 0 deletions
34
src/control/router.py
Normal file
34
src/control/router.py
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
"""
|
||||
Router endpoints for the control module
|
||||
|
||||
Endpoints:
|
||||
- List: Description
|
||||
- Endpoints: Description
|
||||
"""
|
||||
from fastapi import APIRouter, Request
|
||||
from starlette import status
|
||||
|
||||
from src.auth.service import authed_dependency
|
||||
|
||||
from src.control.schemas import ControlTimerPutResponse
|
||||
|
||||
router = APIRouter(
|
||||
tags=["control"],
|
||||
prefix="/control",
|
||||
)
|
||||
|
||||
|
||||
@router.put("/start_timer", status_code=status.HTTP_202_ACCEPTED, response_model=ControlTimerPutResponse)
|
||||
async def start_timer(request: Request):
|
||||
misp_handler = request.app.misp_handler
|
||||
|
||||
await misp_handler.start_timer()
|
||||
return {"state": "starting"}
|
||||
|
||||
|
||||
@router.put("/stop_timer", status_code=status.HTTP_202_ACCEPTED, response_model=ControlTimerPutResponse)
|
||||
async def stop_timer(request: Request):
|
||||
misp_handler = request.app.misp_handler
|
||||
|
||||
misp_handler.stop_timer()
|
||||
return {"state": "stopping"}
|
||||
Loading…
Add table
Add a link
Reference in a new issue