47a8a15598
# Introduction Creating dedicated folders and module for both `page-layout-tab` and `page-layout-widget` The addition diff with deletion is due to the module being added
51 lines
1.3 KiB
TypeScript
51 lines
1.3 KiB
TypeScript
import { Field, InputType } from '@nestjs/graphql';
|
|
|
|
import { Type } from 'class-transformer';
|
|
import {
|
|
IsEnum,
|
|
IsNotEmpty,
|
|
IsObject,
|
|
IsOptional,
|
|
IsString,
|
|
IsUUID,
|
|
ValidateNested,
|
|
} from 'class-validator';
|
|
import { GraphQLJSON } from 'graphql-type-json';
|
|
|
|
import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
|
|
import { GridPositionInput } from 'src/engine/metadata-modules/page-layout-widget/dtos/inputs/grid-position.input';
|
|
import { WidgetType } from 'src/engine/metadata-modules/page-layout-widget/enums/widget-type.enum';
|
|
|
|
@InputType()
|
|
export class CreatePageLayoutWidgetInput {
|
|
@Field(() => UUIDScalarType, { nullable: false })
|
|
@IsUUID()
|
|
@IsNotEmpty()
|
|
pageLayoutTabId: string;
|
|
|
|
@Field({ nullable: false })
|
|
@IsString()
|
|
@IsNotEmpty()
|
|
title: string;
|
|
|
|
@Field(() => WidgetType, { nullable: true, defaultValue: WidgetType.VIEW })
|
|
@IsEnum(WidgetType)
|
|
@IsOptional()
|
|
type?: WidgetType;
|
|
|
|
@Field(() => UUIDScalarType, { nullable: true })
|
|
@IsUUID()
|
|
@IsOptional()
|
|
objectMetadataId?: string | null;
|
|
|
|
@Field(() => GridPositionInput, { nullable: false })
|
|
@ValidateNested()
|
|
@Type(() => GridPositionInput)
|
|
gridPosition: GridPositionInput;
|
|
|
|
@Field(() => GraphQLJSON, { nullable: true })
|
|
@IsObject()
|
|
@IsOptional()
|
|
configuration?: Record<string, unknown> | null;
|
|
}
|