File

src/admin/dtos/create-jurisdiction-fields.dto.ts

Index

Properties

Properties

dataFieldLinkedName
Type : string
Decorators :
@ApiProperty({required: true})
@IsString()
dataFieldLinkedType
Type : DataFieldType
Decorators :
@ApiProperty({required: true, enumName: 'The registry type', enum: undefined})
@IsEnum(DataFieldType)
dataFieldValue
Decorators :
@ApiProperty({required: true})
@IsNotEmpty()
import { ApiProperty } from "@nestjs/swagger";
import {
  ArrayUnique,
  IsArray,
  IsDefined,
  IsEnum,
  IsNotEmpty,
  IsString,
  ValidateNested,
} from "class-validator";
import { Type } from "class-transformer";
import { OmitType } from "@nestjs/mapped-types";
import { DataFieldType } from "../EternalRegistry.interface";
import { GetRegistryDto } from "src/profile/dto/get-registry.dto";

export class NewJurisdictionFieldDto extends OmitType(GetRegistryDto, [
  "registryName",
]) {
  @ApiProperty({ required: true })
  @IsNotEmpty()
  dataFieldValue: unknown;

  @ApiProperty({ required: true })
  @IsString()
  dataFieldLinkedName: string;

  @ApiProperty({
    required: true,
    enumName: "The registry type",
    enum: [
      "Uint",
      "Bool",
      "String",
      "Bytes",
      "Address",
      "AddressArrayIndexValue",
      "getAddressArray",
    ],
  })
  @IsEnum(DataFieldType)
  dataFieldLinkedType: DataFieldType;
}

export class JurisdictionFieldsDto {
  @IsDefined()
  @IsArray()
  @ArrayUnique()
  @ValidateNested()
  @Type(() => NewJurisdictionFieldDto)
  newFields: NewJurisdictionFieldDto[];
}

results matching ""

    No results matching ""