Remove useless columns (#13312)

This commit is contained in:
martmull
2025-07-21 20:41:05 +02:00
committed by GitHub
parent 637b1b628a
commit 96daf5555d
19 changed files with 95 additions and 4671 deletions

View File

@ -1,6 +1,6 @@
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
import { FieldContext } from '@/object-record/record-field/contexts/FieldContext';
import { orderWorkflowRunOutput } from '@/object-record/record-field/meta-types/utils/orderWorkflowRunOutput';
import { orderWorkflowRunState } from '@/object-record/record-field/meta-types/utils/orderWorkflowRunState';
import { FieldJsonValue } from '@/object-record/record-field/types/FieldMetadata';
import { useContext } from 'react';
import { isDefined } from 'twenty-shared/utils';
@ -15,10 +15,10 @@ export const useFormattedJsonFieldValue = ({
if (
fieldDefinition.metadata.objectMetadataNameSingular ===
CoreObjectNameSingular.WorkflowRun &&
fieldDefinition.metadata.fieldName === 'output' &&
fieldDefinition.metadata.fieldName === 'state' &&
isDefined(fieldValue)
) {
return orderWorkflowRunOutput(fieldValue) as FieldJsonValue;
return orderWorkflowRunState(fieldValue) as FieldJsonValue;
}
return fieldValue;

View File

@ -1,6 +1,6 @@
import { CoreObjectNameSingular } from '@/object-metadata/types/CoreObjectNameSingular';
import { FieldContext } from '@/object-record/record-field/contexts/FieldContext';
import { orderWorkflowRunOutput } from '@/object-record/record-field/meta-types/utils/orderWorkflowRunOutput';
import { orderWorkflowRunState } from '@/object-record/record-field/meta-types/utils/orderWorkflowRunState';
import { useContext } from 'react';
import { isDefined, parseJson } from 'twenty-shared/utils';
import { JsonObject, JsonValue } from 'type-fest';
@ -19,10 +19,10 @@ export const usePrecomputedJsonDraftValue = ({
if (
fieldDefinition.metadata.objectMetadataNameSingular ===
CoreObjectNameSingular.WorkflowRun &&
fieldDefinition.metadata.fieldName === 'output' &&
fieldDefinition.metadata.fieldName === 'state' &&
isDefined(draftValue)
) {
return orderWorkflowRunOutput(parsedJsonValue) as JsonObject;
return orderWorkflowRunState(parsedJsonValue) as JsonObject;
}
return parsedJsonValue;

View File

@ -10,6 +10,6 @@ export const isWorkflowRunJsonField = ({
}) => {
return (
objectMetadataNameSingular === CoreObjectNameSingular.WorkflowRun &&
(fieldName === 'output' || fieldName === 'context')
fieldName === 'state'
);
};

View File

@ -1,27 +0,0 @@
import { WorkflowRunOutput } from '@/workflow/types/Workflow';
import { workflowRunOutputSchema } from '@/workflow/validation-schemas/workflowSchema';
import { isDefined } from 'twenty-shared/utils';
import { JsonValue } from 'type-fest';
export const orderWorkflowRunOutput = (value: JsonValue) => {
const parsedValue = workflowRunOutputSchema.safeParse(value);
if (!parsedValue.success) {
return null;
}
const orderedWorkflowRunOutput: WorkflowRunOutput = {
...(isDefined(parsedValue.data.error)
? {
error: parsedValue.data.error,
}
: {}),
...(isDefined(parsedValue.data.stepsOutput)
? {
stepsOutput: parsedValue.data.stepsOutput,
}
: {}),
flow: parsedValue.data.flow,
};
return orderedWorkflowRunOutput;
};

View File

@ -0,0 +1,23 @@
import { WorkflowRunState } from '@/workflow/types/Workflow';
import { workflowRunStateSchema } from '@/workflow/validation-schemas/workflowSchema';
import { isDefined } from 'twenty-shared/utils';
import { JsonValue } from 'type-fest';
export const orderWorkflowRunState = (value: JsonValue) => {
const parsedValue = workflowRunStateSchema.safeParse(value);
if (!parsedValue.success) {
return null;
}
const orderedWorkflowRunState: WorkflowRunState = {
...(isDefined(parsedValue.data.workflowRunError)
? {
workflowRunError: parsedValue.data.workflowRunError,
}
: {}),
stepInfos: parsedValue.data.stepInfos,
flow: parsedValue.data.flow,
};
return orderedWorkflowRunState;
};