Skip to content

The open alternative to Salesforce, designed for AI.

1023 B
Raw Blame
import { Field, ObjectType } from '@nestjs/graphql';

import { IsIn, IsNotEmpty, IsOptional, IsUUID } from 'class-validator';
import {
  type FrontComponentConfiguration,
  type SerializedRelation,
} from 'twenty-shared/types';

import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
import { WidgetConfigurationType } from 'src/engine/metadata-modules/page-layout-widget/enums/widget-configuration-type.type';

@ObjectType('FrontComponentConfiguration')
export class FrontComponentConfigurationDTO implements FrontComponentConfiguration {
  @Field(() => WidgetConfigurationType)
  @IsIn([WidgetConfigurationType.FRONT_COMPONENT])
  @IsNotEmpty()
  configurationType: WidgetConfigurationType.FRONT_COMPONENT;

  @Field(() => UUIDScalarType)
  @IsNotEmpty()
  @IsUUID()
  frontComponentId: SerializedRelation;

  @Field(() => [UUIDScalarType], { nullable: true })
  @IsOptional()
  @IsUUID(undefined, { each: true })
  headerCommandMenuItemUniversalIdentifiers?: string[];
}