diff options
| author | altaf-creator <dev@altafcreator.com> | 2026-01-16 21:32:36 +0800 |
|---|---|---|
| committer | altaf-creator <dev@altafcreator.com> | 2026-01-16 21:32:36 +0800 |
| commit | 3907c41203568f69b947bdde8f16f505eb26ba6a (patch) | |
| tree | cc265acfcbada66c704744e99d3b02f9d8336502 /backend | |
| parent | 586810f149954a33b9c27b1cb3efde3224a10640 (diff) | |
begin implementing OOS backend, status switcheroo
Diffstat (limited to 'backend')
| -rw-r--r-- | backend/main.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/backend/main.py b/backend/main.py index c42e83f..db2519d 100644 --- a/backend/main.py +++ b/backend/main.py @@ -123,6 +123,11 @@ class FinishRequestData(BaseModel): id: int +class OverrideMachineData(BaseModel): + block: int + machine_id: int + + class Status(Enum): EMPTY = 0, FINISHED = 1, @@ -462,3 +467,14 @@ def notif_subscribe(data: notif.PushSubscriptionData, response: fastapi.Response except Exception as err: response.status_code = fastapi.status.HTTP_500_INTERNAL_SERVER_ERROR return f"error, failed to save subscription {err}" + + +# #### ADMIN PANEL API END POINTS #### + + +# --- override each machine status +@app.post("/override_status", response_class=PlainTextResponse) +def override_status(data: OverrideMachineData, response: fastapi.Response, admin_auth: Annotated[str | None, fastapi.Cookie()] = None): + if not admin_auth: + response.status_code = fastapi.status.HTTP_401_UNAUTHORIZED + return "Unauthorised." |
