Files
automatisch/packages/backend/test/mocks/rest/api/v1/flows/get-flows.js
2024-03-08 23:11:42 +01:00

37 lines
813 B
JavaScript

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;