Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

523 B
Raw Blame
import {
  IsOptional,
  IsString,
  MaxLength,
  MinLength,
  ValidateIf,
} from 'class-validator'

export const MAX_PROJECT_PASSWORD_LENGTH = 80

export class ProjectPasswordDto {
  @IsString()
  @MaxLength(MAX_PROJECT_PASSWORD_LENGTH, {
    message: 'Max length is $constraint1 characters',
  })
  @MinLength(1, { message: 'Min length is $constraint1 characters' })
  @IsOptional()
  password?: string | null

  @IsOptional()
  @ValidateIf((o) => o.isPasswordProtected !== null)
  isPasswordProtected?: boolean | null
}