feat: Implement get flows API endpoint

This commit is contained in:
Faruk AYDIN
2024-03-08 23:10:28 +01:00
parent 209ec27a29
commit ea64708c69
8 changed files with 185 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
const getFlowsMock = async (flows, steps) => {
const data = flows.map((flow) => {
const flowSteps = steps.filter((step) => step.flowId === flow.id);
return {
active: flow.active,
id: flow.id,
name: flow.name,
status: flow.active ? 'published' : 'draft',
steps: flowSteps.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: data.length,
currentPage: 1,
isArray: true,
totalPages: 1,
type: 'Flow',
},
};
};
export default getFlowsMock;