Files
twenty/packages/twenty-server/src/engine/metadata-modules/cron-trigger/utils/from-create-cron-trigger-input-to-flat-cron-trigger.util.ts
T
Weiko 68b21d2942 Add db event trigger and cron trigger to migration v2 (#14772)
## Context
Add DB events triggers and Cron triggers to migration v2 builder/runner
(and adding corresponding services/resolvers)
2025-09-30 11:14:18 +02:00

25 lines
748 B
TypeScript

import { v4 as uuidv4 } from 'uuid';
import { type CreateCronTriggerInput } from 'src/engine/metadata-modules/cron-trigger/dtos/create-cron-trigger.input';
import { type FlatCronTrigger } from 'src/engine/metadata-modules/cron-trigger/types/flat-cron-trigger.type';
export const fromCreateCronTriggerInputToFlatCronTrigger = ({
createCronTriggerInput,
workspaceId,
}: {
createCronTriggerInput: CreateCronTriggerInput;
workspaceId: string;
}): FlatCronTrigger => {
const now = new Date();
return {
id: uuidv4(),
universalIdentifier: uuidv4(),
settings: createCronTriggerInput.settings,
serverlessFunctionId: createCronTriggerInput.serverlessFunctionId,
workspaceId,
createdAt: now,
updatedAt: now,
};
};