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!

1.8 KB
Raw Blame
import { IsBoolean, IsOptional, IsInt, Min, Max, IsIn } from 'class-validator'
import { IntersectionType, PartialType } from '@nestjs/mapped-types'
import { ApiProperty } from '@nestjs/swagger'
import { ProjectDTO } from './project.dto'
import { ProjectPasswordDto } from './project-password.dto'

export class UpdateProjectDto extends IntersectionType(
  PartialType(ProjectDTO),
  ProjectPasswordDto,
) {
  @ApiProperty({
    required: false,
    description:
      "The project's state. If enabled - all the incoming analytics data will be saved.",
  })
  active?: boolean

  @ApiProperty({
    required: false,
    description:
      "When true, anyone on the internet (including Google) would be able to see the project's Dashboard.",
  })
  public?: boolean

  @ApiProperty({
    required: false,
    description:
      'When true, the incoming data will not be gathered for this project',
    default: false,
  })
  @IsBoolean()
  @IsOptional()
  isArchived?: boolean

  @ApiProperty({
    required: false,
    description:
      'CAPTCHA PoW difficulty (number of leading zeros required). Higher = harder. Range: 2-6.',
    default: 4,
    minimum: 2,
    maximum: 6,
  })
  @IsInt()
  @Min(2)
  @Max(6)
  @IsOptional()
  captchaDifficulty?: number

  @ApiProperty({
    required: false,
    description:
      'CAPTCHA difficulty mode. Manual uses captchaDifficulty directly; auto selects difficulty dynamically from risk signals.',
    enum: ['manual', 'auto'],
    default: 'manual',
  })
  @IsIn(['manual', 'auto'])
  @IsOptional()
  captchaDifficultyMode?: 'manual' | 'auto'

  @ApiProperty({
    required: false,
    description: 'Session replay retention in days.',
    enum: [30, 90, 365, 1825],
    default: 30,
  })
  @IsInt()
  @IsIn([30, 90, 365, 1825])
  @IsOptional()
  sessionReplayRetentionDays?: number
}