Reorganize logic function files (#17766)

reorganize according to

<img width="1243" height="725" alt="Pasted Graphic"
src="https://github.com/user-attachments/assets/ba65dd10-8eec-4b13-ad49-9726edd3b79c"
/>

Not working yet
This commit is contained in:
martmull
2026-02-09 12:36:39 +01:00
committed by GitHub
parent bf4c348c8b
commit 9162685b2e
149 changed files with 1715 additions and 5272 deletions
@@ -0,0 +1,52 @@
import { Field, HideField, InputType } from '@nestjs/graphql';
import {
IsBoolean,
IsNotEmpty,
IsNumber,
IsObject,
IsOptional,
IsString,
Max,
Min,
} from 'class-validator';
import graphqlTypeJson from 'graphql-type-json';
@InputType()
export class CreateDefaultLogicFunctionInput {
@IsString()
@IsNotEmpty()
@Field()
name: string;
@IsString()
@IsOptional()
@Field({ nullable: true })
description?: string;
@IsNumber()
@Field({ nullable: true })
@Min(1)
@Max(900)
@IsOptional()
timeoutSeconds?: number;
@HideField()
applicationId?: string;
@HideField()
universalIdentifier?: string;
@HideField()
id?: string;
@Field(() => graphqlTypeJson, { nullable: true })
@IsObject()
@IsOptional()
toolInputSchema?: object;
@IsBoolean()
@Field({ nullable: true })
@IsOptional()
isTool?: boolean;
}
@@ -11,7 +11,13 @@ import {
Min,
} from 'class-validator';
import graphqlTypeJson from 'graphql-type-json';
import { Sources } from 'twenty-shared/types';
import {
CronTriggerSettings,
DatabaseEventTriggerSettings,
HttpRouteTriggerSettings,
} from 'twenty-shared/application';
import type { JsonbProperty } from 'src/engine/workspace-manager/workspace-migration/universal-flat-entity/types/jsonb-property.type';
@InputType()
export class CreateLogicFunctionInput {
@@ -33,36 +39,28 @@ export class CreateLogicFunctionInput {
timeoutSeconds?: number;
@HideField()
applicationId?: string;
applicationId: string;
@HideField()
universalIdentifier?: string;
@HideField()
id?: string;
id: string;
@HideField()
checksum?: string;
@Field(() => graphqlTypeJson, { nullable: true })
@IsObject()
@IsOptional()
code?: Sources;
checksum: string;
@IsString()
@Field({ nullable: true })
@IsOptional()
handlerName?: string;
@Field({ nullable: false })
handlerName: string;
@IsString()
@Field({ nullable: true })
@IsOptional()
sourceHandlerPath?: string;
@Field({ nullable: false })
sourceHandlerPath: string;
@IsString()
@Field({ nullable: true })
@IsOptional()
builtHandlerPath?: string;
@Field({ nullable: false })
builtHandlerPath: string;
@Field(() => graphqlTypeJson, { nullable: true })
@IsObject()
@@ -73,4 +71,19 @@ export class CreateLogicFunctionInput {
@Field({ nullable: true })
@IsOptional()
isTool?: boolean;
@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>;
}
@@ -1,9 +0,0 @@
import { ID, InputType } from '@nestjs/graphql';
import { IDField } from '@ptc-org/nestjs-query-graphql';
@InputType()
export class GetLogicFunctionSourceCodeInput {
@IDField(() => ID, { description: 'The id of the function.' })
id!: string;
}
@@ -16,13 +16,13 @@ import {
IsUUID,
} from 'class-validator';
import graphqlTypeJson from 'graphql-type-json';
import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
import {
CronTriggerSettings,
DatabaseEventTriggerSettings,
HttpRouteTriggerSettings,
} from 'src/engine/metadata-modules/logic-function/logic-function.entity';
} from 'twenty-shared/application';
import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
@ObjectType('LogicFunction')
@Authorize({
@@ -14,10 +14,14 @@ import {
ValidateNested,
} from 'class-validator';
import graphqlTypeJson from 'graphql-type-json';
import type { Sources } from 'twenty-shared/types';
import {
CronTriggerSettings,
DatabaseEventTriggerSettings,
HttpRouteTriggerSettings,
} from 'twenty-shared/application';
import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
import type { JsonbProperty } from 'src/engine/workspace-manager/workspace-migration/universal-flat-entity/types/jsonb-property.type';
@InputType()
class UpdateLogicFunctionInputUpdates {
@@ -38,11 +42,6 @@ class UpdateLogicFunctionInputUpdates {
@IsOptional()
timeoutSeconds?: number;
@Field(() => graphqlTypeJson, { nullable: true })
@IsObject()
@IsOptional()
code?: Sources;
@IsString()
@Field({ nullable: true })
@IsOptional()
@@ -67,10 +66,30 @@ class UpdateLogicFunctionInputUpdates {
@Field({ nullable: true })
@IsOptional()
isTool?: boolean;
@IsString()
@Field({ nullable: true })
@IsOptional()
checksum?: 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>;
}
@InputType()
export class UpdateLogicFunctionInput {
export class UpdateLogicFunctionSourceInput {
@Field(() => UUIDScalarType, {
description: 'Id of the logic function to update',
})