feat: Implement update flow status rest API endpoint

This commit is contained in:
Faruk AYDIN
2024-09-17 16:07:12 +03:00
parent 712a5756e2
commit 1790ef0ee6
7 changed files with 350 additions and 3 deletions

View File

@@ -0,0 +1,37 @@
const updateFlowStatusMock = 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 updateFlowStatusMock;