twenty / packages /twenty-server /src /engine /metadata-modules /logic-function /utils /from-flat-logic-function-to-logic-function-dto.util.ts
Jules
Initial clean CRM deployment with prebuilt assets
d9494a5
Raw
History Blame Contribute Delete
1.51 kB
import { type LogicFunctionDTO } from 'src/engine/metadata-modules/logic-function/dtos/logic-function.dto';
import { type FlatLogicFunction } from 'src/engine/metadata-modules/logic-function/types/flat-logic-function.type';
export const fromFlatLogicFunctionToLogicFunctionDto = ({
flatLogicFunction,
}: {
flatLogicFunction: FlatLogicFunction;
}): LogicFunctionDTO => {
return {
id: flatLogicFunction.id,
universalIdentifier: flatLogicFunction.universalIdentifier,
name: flatLogicFunction.name,
description: flatLogicFunction.description ?? undefined,
runtime: flatLogicFunction.runtime,
timeoutSeconds: flatLogicFunction.timeoutSeconds,
executionMode: flatLogicFunction.executionMode,
sourceHandlerPath: flatLogicFunction.sourceHandlerPath,
handlerName: flatLogicFunction.handlerName,
applicationId: flatLogicFunction.applicationId ?? undefined,
workspaceId: flatLogicFunction.workspaceId,
createdAt: new Date(flatLogicFunction.createdAt),
updatedAt: new Date(flatLogicFunction.updatedAt),
cronTriggerSettings: flatLogicFunction.cronTriggerSettings ?? undefined,
databaseEventTriggerSettings:
flatLogicFunction.databaseEventTriggerSettings ?? undefined,
httpRouteTriggerSettings:
flatLogicFunction.httpRouteTriggerSettings ?? undefined,
toolTriggerSettings: flatLogicFunction.toolTriggerSettings ?? undefined,
workflowActionTriggerSettings:
flatLogicFunction.workflowActionTriggerSettings ?? undefined,
};
};