chore: lint
This commit is contained in:
@@ -61,46 +61,45 @@ const formatRecordingById = (recordingData: any) => {
|
||||
const recordingMeta = recordingData.recording_meta;
|
||||
const workflow = recordingData.recording.workflow || [];
|
||||
const firstWorkflowStep = workflow[0]?.where?.url || '';
|
||||
|
||||
const inputParameters = [
|
||||
{
|
||||
type: "string",
|
||||
name: "originUrl",
|
||||
label: "Origin URL",
|
||||
required: true,
|
||||
defaultValue: firstWorkflowStep,
|
||||
},
|
||||
];
|
||||
|
||||
return {
|
||||
id: recordingMeta.id,
|
||||
name: recordingMeta.name,
|
||||
createdAt: new Date(recordingMeta.create_date).getTime(),
|
||||
inputParameters,
|
||||
};
|
||||
};
|
||||
|
||||
router.get("/recordings/:fileName", requireAPIKey, async (req: Request, res: Response) => {
|
||||
const inputParameters = [
|
||||
{
|
||||
type: "string",
|
||||
name: "originUrl",
|
||||
label: "Origin URL",
|
||||
required: true,
|
||||
defaultValue: firstWorkflowStep,
|
||||
},
|
||||
];
|
||||
|
||||
return {
|
||||
id: recordingMeta.id,
|
||||
name: recordingMeta.name,
|
||||
createdAt: new Date(recordingMeta.create_date).getTime(),
|
||||
inputParameters,
|
||||
};
|
||||
};
|
||||
|
||||
router.get("/recordings/:fileName", requireAPIKey, async (req: Request, res: Response) => {
|
||||
try {
|
||||
const fileContent = await readFile(`./../storage/recordings/${req.params.fileName}.waw.json`);
|
||||
|
||||
const recordingData = JSON.parse(fileContent);
|
||||
const formattedRecording = formatRecording(recordingData);
|
||||
|
||||
const response = {
|
||||
statusCode: 200,
|
||||
messageCode: "success",
|
||||
robot: formattedRecording,
|
||||
};
|
||||
|
||||
res.status(200).json(response);
|
||||
const fileContent = await readFile(`./../storage/recordings/${req.params.fileName}.waw.json`);
|
||||
|
||||
const recordingData = JSON.parse(fileContent);
|
||||
const formattedRecording = formatRecording(recordingData);
|
||||
|
||||
const response = {
|
||||
statusCode: 200,
|
||||
messageCode: "success",
|
||||
robot: formattedRecording,
|
||||
};
|
||||
|
||||
res.status(200).json(response);
|
||||
} catch (error) {
|
||||
console.error("Error fetching recording:", error);
|
||||
res.status(404).json({
|
||||
statusCode: 404,
|
||||
messageCode: "not_found",
|
||||
message: `Recording with name "${req.params.fileName}" not found.`,
|
||||
});
|
||||
console.error("Error fetching recording:", error);
|
||||
res.status(404).json({
|
||||
statusCode: 404,
|
||||
messageCode: "not_found",
|
||||
message: `Recording with name "${req.params.fileName}" not found.`,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user