class-validator#isBoolean TypeScript Examples

The following examples show how to use class-validator#isBoolean. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: classes.ts    From epicgames-freegames-node with MIT License 6 votes vote down vote up
/**
   * If true, provide a remotely accessible web address via [localtunnel](https://localtunnel.me) without the need to port forward or reverse proxy
   * @example true
   * @default false
   * @env LOCAL_TUNNEL
   */
  @IsOptional()
  @IsBoolean()
  localtunnel? = process.env.LOCAL_TUNNEL?.toLowerCase() === 'true' || false;
Example #2
Source File: custom-validators.ts    From relate with GNU General Public License v3.0 6 votes vote down vote up
export function IsPluginConfig(validationOptions?: ValidationOptions) {
    return (object: any, propertyName: string) => {
        registerDecorator({
            name: 'isPluginConfig',
            target: object.constructor,
            propertyName: propertyName,
            options: validationOptions,
            validator: {
                validate(value: any, _args: ValidationArguments) {
                    if (isObjectLike(value)) {
                        return Object.entries(value).every(([_, v]) => {
                            if (isArray(v)) {
                                // eslint-disable-next-line @typescript-eslint/ban-ts-comment
                                // @ts-ignore
                                return Array.from(v).every(isString);
                            }

                            return isString(v) || isBoolean(v);
                        });
                    }

                    return false;
                },
                defaultMessage(args?: ValidationArguments) {
                    const expectedMsg = 'Expected "{ [key: string]: string | string[] | boolean }"';

                    if (!args) {
                        return expectedMsg;
                    }

                    const strValue = JSON.stringify(args.value);
                    return `${expectedMsg} on "${args.property}" but found "${strValue}" instead`;
                },
            },
        });
    };
}
Example #3
Source File: user-update-request.dto.ts    From nestjs-api-example with MIT License 5 votes vote down vote up
@IsNotEmpty({ message: '활동(isActive)은 필수값입니다.' })
  @IsBoolean({ message: '활동(isActive)의 형식이 올바르지 않습니다.' })
  @ApiProperty({ description: '활동' })
  isActive: boolean;
Example #4
Source File: update-user.dto.ts    From nest-js-boilerplate with MIT License 5 votes vote down vote up
@ApiPropertyOptional({
    type: Boolean,
  })
  @IsOptional()
  @IsBoolean()
  readonly verified: boolean = false;
Example #5
Source File: whisp.input.ts    From whispr with MIT License 5 votes vote down vote up
@Field(() => Boolean, { nullable: true })
  @IsBoolean()
  @IsOptional()
  closed?: boolean;
Example #6
Source File: shared.dto.ts    From affinidi-core-sdk with Apache License 2.0 5 votes vote down vote up
@IsBoolean()
  @IsOptional()
  skipBackupEncryptedSeed?: boolean
Example #7
Source File: create-collection.dto.ts    From aqualink-app with MIT License 5 votes vote down vote up
@IsOptional()
  @IsBoolean()
  isPublic?: boolean;
Example #8
Source File: organizations.ts    From crossfeed with Creative Commons Zero v1.0 Universal 5 votes vote down vote up
@IsBoolean()
  isPassive: boolean;
Example #9
Source File: classes.ts    From epicgames-freegames-node with MIT License 5 votes vote down vote up
/**
   * true for SSL (port 465), false for TLS or unsecure
   * @example true
   * @default false
   * @env SMTP_SECURE
   */
  @IsBoolean()
  secure = false;
Example #10
Source File: create-announcement.dto.ts    From edu-server with MIT License 5 votes vote down vote up
/**
   * Whether the announcement was read or not
   * @example true
   */
  @IsNotEmpty()
  @IsBoolean()
  read: boolean;
Example #11
Source File: config.ts    From ts-di-starter with MIT License 5 votes vote down vote up
@IsBoolean()
  pubsubEmulator: boolean;
Example #12
Source File: commit-p2p-payment-channel.dto.ts    From etherspot-sdk with MIT License 5 votes vote down vote up
@IsOptional()
  @IsBoolean()
  deposit?: boolean = true;
Example #13
Source File: rsa.ts    From Deep-Lynx with MIT License 5 votes vote down vote up
@IsBoolean()
    valueRequired?: boolean;
Example #14
Source File: field.dto.ts    From ironfish-api with Mozilla Public License 2.0 5 votes vote down vote up
@IsBoolean()
  @Type(() => Boolean)
  readonly value!: boolean;
Example #15
Source File: createSubmission.dto.ts    From coronatest with GNU Affero General Public License v3.0 5 votes vote down vote up
@IsBoolean()
    @IsOptional()
    high_risk_country: boolean;
Example #16
Source File: user-create-input.dto.ts    From nestjs-starter-rest-api with MIT License 5 votes vote down vote up
@ApiProperty()
  @IsBoolean()
  isAccountDisabled: boolean;
Example #17
Source File: todo.dto.ts    From postgres-nest-react-typescript-boilerplate with GNU General Public License v3.0 5 votes vote down vote up
@IsBoolean()
  completed: boolean;
Example #18
Source File: dbms-plugin.model.ts    From relate with GNU General Public License v3.0 5 votes vote down vote up
@IsOptional()
    @IsBoolean()
    public isOfficial?: boolean;
Example #19
Source File: User.ts    From tezos-academy with MIT License 5 votes vote down vote up
@Property({ nullable: true, optional: true })
  @IsOptional()
  @IsBoolean()
  emailVerified?: boolean
Example #20
Source File: create-contact-phone.dto.ts    From nestjs-starter with MIT License 5 votes vote down vote up
@ApiProperty()
  @IsBoolean()
  @ToBoolean()
  @IsOptional()
  sms: boolean;
Example #21
Source File: index.ts    From office-hours with GNU General Public License v3.0 5 votes vote down vote up
@IsBoolean()
  @IsOptional()
  desktopNotifsEnabled?: boolean;