feat: get robot by id /api/robots/id
This commit is contained in:
@@ -77,12 +77,16 @@ const formatRecordingById = (recordingData: any) => {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
router.get("/robots/:fileName", requireAPIKey, async (req: Request, res: Response) => {
|
router.get("/robots/:id", requireAPIKey, async (req: Request, res: Response) => {
|
||||||
try {
|
try {
|
||||||
const fileContent = await readFile(`./../storage/recordings/${req.params.fileName}.waw.json`);
|
const robot = await Robot.findOne({
|
||||||
|
where: {
|
||||||
|
'recording_meta.id': req.params.id
|
||||||
|
},
|
||||||
|
raw: true
|
||||||
|
});
|
||||||
|
|
||||||
const recordingData = JSON.parse(fileContent);
|
const formattedRecording = formatRecordingById(robot);
|
||||||
const formattedRecording = formatRecordingById(recordingData);
|
|
||||||
|
|
||||||
const response = {
|
const response = {
|
||||||
statusCode: 200,
|
statusCode: 200,
|
||||||
|
|||||||
Reference in New Issue
Block a user