twenty / packages /twenty-server /src /engine /metadata-modules /logic-function /dtos /update-logic-function-from-source.input.ts
Jules
Initial clean CRM deployment with prebuilt assets
d9494a5
Raw
History Blame Contribute Delete
2.75 kB
import { Field, InputType } from '@nestjs/graphql';
import { Type } from 'class-transformer';
import {
IsNotEmpty,
IsNumber,
IsObject,
IsOptional,
IsString,
IsUUID,
Matches,
Max,
Min,
ValidateNested,
} from 'class-validator';
import graphqlTypeJson from 'graphql-type-json';
import {
CronTriggerSettings,
DatabaseEventTriggerSettings,
HttpRouteTriggerSettings,
ToolTriggerSettings,
WorkflowActionTriggerSettings,
} from 'twenty-shared/application';
import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
import { HANDLER_NAME_REGEX } from 'src/engine/metadata-modules/logic-function/constants/handler.contant';
import type { JsonbProperty } from 'src/engine/workspace-manager/workspace-migration/universal-flat-entity/types/jsonb-property.type';
@InputType()
class UpdateLogicFunctionFromSourceInputUpdates {
@IsString()
@Field({ nullable: true })
@IsOptional()
name?: string;
@IsString()
@Field({ nullable: true })
@IsOptional()
description?: string;
@IsNumber()
@Field({ nullable: true })
@Min(1)
@Max(900)
@IsOptional()
timeoutSeconds?: number;
@IsString()
@Field({ nullable: true })
@IsOptional()
sourceHandlerCode?: string;
@IsString()
@Matches(HANDLER_NAME_REGEX, {
message: 'handlerName must be a valid JavaScript identifier or dotted path',
})
@Field({ nullable: true })
@IsOptional()
handlerName?: string;
@IsString()
@Field({ nullable: true })
@IsOptional()
sourceHandlerPath?: string;
@IsObject()
@Field(() => graphqlTypeJson, { nullable: true })
@IsOptional()
cronTriggerSettings?: JsonbProperty<CronTriggerSettings>;
@IsObject()
@Field(() => graphqlTypeJson, { nullable: true })
@IsOptional()
databaseEventTriggerSettings?: JsonbProperty<DatabaseEventTriggerSettings>;
@IsObject()
@Field(() => graphqlTypeJson, { nullable: true })
@IsOptional()
httpRouteTriggerSettings?: JsonbProperty<HttpRouteTriggerSettings>;
@IsObject()
@Field(() => graphqlTypeJson, { nullable: true })
@IsOptional()
toolTriggerSettings?: JsonbProperty<ToolTriggerSettings>;
@IsObject()
@Field(() => graphqlTypeJson, { nullable: true })
@IsOptional()
workflowActionTriggerSettings?: JsonbProperty<WorkflowActionTriggerSettings>;
}
@InputType()
export class UpdateLogicFunctionFromSourceInput {
@Field(() => UUIDScalarType, {
description: 'Id of the logic function to update',
})
@IsNotEmpty()
@IsUUID()
id: string;
@Type(() => UpdateLogicFunctionFromSourceInputUpdates)
@ValidateNested()
@Field(() => UpdateLogicFunctionFromSourceInputUpdates, {
description: 'The logic function updates',
})
update: UpdateLogicFunctionFromSourceInputUpdates;
}