fix: expose missing createdAt and updatedAt fields from flow

This commit is contained in:
Rıdvan Akca
2024-04-12 16:46:21 +02:00
parent e5be8d3ba7
commit ab37250d5d
7 changed files with 13 additions and 0 deletions

View File

@@ -6,6 +6,8 @@ const flowSerializer = (flow) => {
name: flow.name, name: flow.name,
active: flow.active, active: flow.active,
status: flow.status, status: flow.status,
createdAt: flow.createdAt.getTime(),
updatedAt: flow.updatedAt.getTime(),
}; };
if (flow.steps?.length > 0) { if (flow.steps?.length > 0) {

View File

@@ -27,6 +27,8 @@ describe('flowSerializer', () => {
name: flow.name, name: flow.name,
active: flow.active, active: flow.active,
status: flow.status, status: flow.status,
createdAt: flow.createdAt.getTime(),
updatedAt: flow.updatedAt.getTime(),
}; };
expect(flowSerializer(flow)).toEqual(expectedPayload); expect(flowSerializer(flow)).toEqual(expectedPayload);

View File

@@ -9,6 +9,8 @@ const getExecutionMock = async (execution, flow, steps) => {
name: flow.name, name: flow.name,
active: flow.active, active: flow.active,
status: flow.active ? 'published' : 'draft', status: flow.active ? 'published' : 'draft',
createdAt: flow.createdAt.getTime(),
updatedAt: flow.updatedAt.getTime(),
steps: steps.map((step) => ({ steps: steps.map((step) => ({
id: step.id, id: step.id,
type: step.type, type: step.type,

View File

@@ -10,6 +10,8 @@ const getExecutionsMock = async (executions, flow, steps) => {
name: flow.name, name: flow.name,
active: flow.active, active: flow.active,
status: flow.active ? 'published' : 'draft', status: flow.active ? 'published' : 'draft',
createdAt: flow.createdAt.getTime(),
updatedAt: flow.updatedAt.getTime(),
steps: steps.map((step) => ({ steps: steps.map((step) => ({
id: step.id, id: step.id,
type: step.type, type: step.type,

View File

@@ -4,6 +4,8 @@ const getFlowMock = async (flow, steps) => {
id: flow.id, id: flow.id,
name: flow.name, name: flow.name,
status: flow.active ? 'published' : 'draft', status: flow.active ? 'published' : 'draft',
createdAt: flow.createdAt.getTime(),
updatedAt: flow.updatedAt.getTime(),
steps: steps.map((step) => ({ steps: steps.map((step) => ({
appKey: step.appKey, appKey: step.appKey,
iconUrl: step.iconUrl, iconUrl: step.iconUrl,

View File

@@ -7,6 +7,8 @@ const getFlowsMock = async (flows, steps) => {
id: flow.id, id: flow.id,
name: flow.name, name: flow.name,
status: flow.active ? 'published' : 'draft', status: flow.active ? 'published' : 'draft',
createdAt: flow.createdAt.getTime(),
updatedAt: flow.updatedAt.getTime(),
steps: flowSteps.map((step) => ({ steps: flowSteps.map((step) => ({
appKey: step.appKey, appKey: step.appKey,
iconUrl: step.iconUrl, iconUrl: step.iconUrl,

View File

@@ -241,6 +241,7 @@ export const FlowPropType = PropTypes.shape({
PropTypes.instanceOf(Date), PropTypes.instanceOf(Date),
]), ]),
updatedAt: PropTypes.oneOfType([ updatedAt: PropTypes.oneOfType([
PropTypes.number,
PropTypes.string, PropTypes.string,
PropTypes.instanceOf(Date), PropTypes.instanceOf(Date),
]), ]),