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!

Limit custom metrics amount within one view to 3

Blue Mouseed73a1727157
diff --git a/apps/production/src/project/dto/create-project-view.dto.ts b/apps/production/src/project/dto/create-project-view.dto.ts
index 2445ae9c0..e4e221bd7 100644
--- a/apps/production/src/project/dto/create-project-view.dto.ts
+++ b/apps/production/src/project/dto/create-project-view.dto.ts
@@ -1,4 +1,5 @@
import {
+ ArrayMaxSize,
IsEnum,
IsNotEmpty,
IsOptional,
@@ -52,6 +53,8 @@ export interface Filter {
isExclusive: boolean
}
+export const MAX_METRICS_IN_VIEW = 3
+
export class CreateProjectViewDto {
@ApiProperty()
@MaxLength(20)
@@ -81,5 +84,6 @@ export class CreateProjectViewDto {
})
@ValidateNested()
@IsOptional()
+ @ArrayMaxSize(MAX_METRICS_IN_VIEW)
customEvents?: ProjectViewCustomEventDto[]
}
diff --git a/apps/production/src/project/dto/update-project-view.dto.ts b/apps/production/src/project/dto/update-project-view.dto.ts
index cbf5ae42d..b62ab8a63 100644
--- a/apps/production/src/project/dto/update-project-view.dto.ts
+++ b/apps/production/src/project/dto/update-project-view.dto.ts
@@ -2,5 +2,5 @@ import { PartialType, OmitType } from '@nestjs/swagger'
import { CreateProjectViewDto } from './create-project-view.dto'
export class UpdateProjectViewDto extends PartialType(
- OmitType(CreateProjectViewDto, ['type', 'customEvents'] as const),
+ OmitType(CreateProjectViewDto, ['type'] as const),
) {}