blob: 7218e66d55ca246e354bf18f0bf1ec1dbc4228bf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
import { Request, Response } from "express";
import { setAllRobotsIdle } from "../simulation/robotMovementSimulator";
import { ErrorResponse } from "../types/error";
import { SimulationResponse } from "../types/robot";
async function stopAllRobots(_req: Request, res: Response) {
try {
const result: SimulationResponse = await setAllRobotsIdle();
return res.status(200).json(result);
} catch (error) {
console.error("Error on trying to stop all robots:", error);
const errorResponse: ErrorResponse = {
message: "Internal server error on trying to stop all robots.",
error,
};
return res.status(500).json(errorResponse);
}
}
export default stopAllRobots;
|