cb010d90fe
Add a post hook to restore workflow sub-entities
77 lines
1.5 KiB
TypeScript
77 lines
1.5 KiB
TypeScript
import { Field, HideField, ObjectType } from '@nestjs/graphql';
|
|
|
|
import {
|
|
Authorize,
|
|
IDField,
|
|
QueryOptions,
|
|
} from '@ptc-org/nestjs-query-graphql';
|
|
import {
|
|
IsArray,
|
|
IsDateString,
|
|
IsNotEmpty,
|
|
IsNumber,
|
|
IsString,
|
|
IsUUID,
|
|
} from 'class-validator';
|
|
import GraphQLJSON from 'graphql-type-json';
|
|
|
|
import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
|
|
import { InputSchema } from 'src/modules/workflow/workflow-builder/workflow-schema/types/input-schema.type';
|
|
|
|
@ObjectType('ServerlessFunction')
|
|
@Authorize({
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
authorize: (context: any) => ({
|
|
workspaceId: { eq: context?.req?.workspace?.id },
|
|
}),
|
|
})
|
|
@QueryOptions({
|
|
defaultResultSize: 10,
|
|
maxResultsSize: 1000,
|
|
})
|
|
export class ServerlessFunctionDTO {
|
|
@IsUUID()
|
|
@IsNotEmpty()
|
|
@IDField(() => UUIDScalarType)
|
|
id: string;
|
|
|
|
@IsString()
|
|
@Field()
|
|
name: string;
|
|
|
|
@IsString()
|
|
@Field({ nullable: true })
|
|
description: string;
|
|
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
@Field()
|
|
runtime: string;
|
|
|
|
@IsNumber()
|
|
@Field()
|
|
timeoutSeconds: number;
|
|
|
|
@IsString()
|
|
@Field({ nullable: true })
|
|
latestVersion: string;
|
|
|
|
@IsArray()
|
|
@Field(() => [String], { nullable: false })
|
|
publishedVersions: string[];
|
|
|
|
@Field(() => GraphQLJSON, { nullable: true })
|
|
latestVersionInputSchema: InputSchema;
|
|
|
|
@HideField()
|
|
workspaceId: string;
|
|
|
|
@IsDateString()
|
|
@Field()
|
|
createdAt: Date;
|
|
|
|
@IsDateString()
|
|
@Field()
|
|
updatedAt: Date;
|
|
}
|