feat: Add execution serializer
This commit is contained in:
18
packages/backend/src/serializers/execution.js
Normal file
18
packages/backend/src/serializers/execution.js
Normal file
@@ -0,0 +1,18 @@
|
||||
import flowSerializer from './flow.js';
|
||||
|
||||
const executionSerializer = (execution) => {
|
||||
let executionData = {
|
||||
id: execution.id,
|
||||
testRun: execution.testRun,
|
||||
createdAt: execution.createdAt.getTime(),
|
||||
updatedAt: execution.updatedAt.getTime(),
|
||||
};
|
||||
|
||||
if (execution.flow) {
|
||||
executionData.flow = flowSerializer(execution.flow);
|
||||
}
|
||||
|
||||
return executionData;
|
||||
};
|
||||
|
||||
export default executionSerializer;
|
@@ -8,7 +8,7 @@ const flowSerializer = (flow) => {
|
||||
status: flow.status,
|
||||
};
|
||||
|
||||
if (flow.steps) {
|
||||
if (flow.steps?.length > 0) {
|
||||
flowData.steps = flow.steps.map((step) => stepSerializer(step));
|
||||
}
|
||||
|
||||
|
@@ -9,6 +9,7 @@ import appSerializer from './app.js';
|
||||
import authSerializer from './auth.js';
|
||||
import triggerSerializer from './trigger.js';
|
||||
import actionSerializer from './action.js';
|
||||
import executionSerializer from './execution.js';
|
||||
|
||||
const serializers = {
|
||||
User: userSerializer,
|
||||
@@ -22,6 +23,7 @@ const serializers = {
|
||||
Auth: authSerializer,
|
||||
Trigger: triggerSerializer,
|
||||
Action: actionSerializer,
|
||||
Execution: executionSerializer,
|
||||
};
|
||||
|
||||
export default serializers;
|
||||
|
Reference in New Issue
Block a user