feat: Implement get flows API endpoint
This commit is contained in:
36
packages/backend/test/mocks/rest/api/v1/flows/get-flows.js
Normal file
36
packages/backend/test/mocks/rest/api/v1/flows/get-flows.js
Normal 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;
|
Reference in New Issue
Block a user