feat: write REST API endpoint to duplicate flow

This commit is contained in:
Ali BARIN
2024-09-11 09:26:41 +00:00
committed by Faruk AYDIN
parent 776d027dfa
commit 0d126a8e2b
6 changed files with 470 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
const getFlowMock = async (flow, steps = []) => {
const data = {
active: flow.active,
id: flow.id,
name: flow.name,
status: flow.active ? 'published' : 'draft',
createdAt: flow.createdAt.getTime(),
updatedAt: flow.updatedAt.getTime(),
};
if (steps.length) {
data.steps = steps.map((step) => ({
appKey: step.appKey,
iconUrl: step.iconUrl,
id: step.id,
key: step.key,
parameters: step.parameters,
position: step.position,
status: step.status,
type: step.type,
webhookUrl: step.webhookUrl,
}));
}
return {
data: data,
meta: {
count: 1,
currentPage: null,
isArray: false,
totalPages: null,
type: 'Flow',
},
};
};
export default getFlowMock;