From e836e7dd4ed5e9fa60e949d159100040b22a8f48 Mon Sep 17 00:00:00 2001 From: Arne Rief Date: Mon, 22 Dec 2025 21:20:39 +0100 Subject: Movement simulator for all and single robot, project v1 ready --- backend/src/types/express.d.ts | 5 ----- backend/src/types/robot.ts | 30 ++++++++++++++++++++++++------ backend/src/types/user.ts | 7 +++++++ 3 files changed, 31 insertions(+), 11 deletions(-) (limited to 'backend/src/types') diff --git a/backend/src/types/express.d.ts b/backend/src/types/express.d.ts index 266a9f9..7e93345 100644 --- a/backend/src/types/express.d.ts +++ b/backend/src/types/express.d.ts @@ -1,12 +1,7 @@ import type { AuthorizedUser } from "./user.js"; -import { Server } from "socket.io"; declare global { namespace Express { - interface Application { - io: Server; - } - interface Request { user?: AuthorizedUser; } diff --git a/backend/src/types/robot.ts b/backend/src/types/robot.ts index 40ce282..fe20422 100644 --- a/backend/src/types/robot.ts +++ b/backend/src/types/robot.ts @@ -1,14 +1,16 @@ export type RobotPosition = { - lat: number; - lon: number; + lat: string; + lon: string; }; +export type RobotStatus = "idle" | "moving"; + export type Robot = { id: number; name: string; - status: "idle" | "moving"; - lat: number; - lon: number; + status: RobotStatus; + lat: string; + lon: string; robot_positions: RobotPosition[]; created_at: string; updated_at: string; @@ -16,5 +18,21 @@ export type Robot = { export type RobotsResponse = { source: "cache" | "database"; - data: Robot[]; + robots: Robot[]; + simulationRunning: boolean; +}; + +export type CreateRobotResponse = { + message: string; + robot: Robot; +}; + +export type RobotsUpdateBroadcast = { + updatedRobots: Robot[]; +}; + +export type SimulationResponse = { + message: string; + status?: RobotStatus; }; + diff --git a/backend/src/types/user.ts b/backend/src/types/user.ts index b2c7ffc..15b24c3 100644 --- a/backend/src/types/user.ts +++ b/backend/src/types/user.ts @@ -16,3 +16,10 @@ export type DatabaseUser = { password_hash: string; created_at: string; }; + +export type LoginResponse = { + message: string; + user: AuthorizedUser; + token: string; +}; + -- cgit v1.2.3