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!

Update ProjectViewCustomEventDto with CreateProjectViewDTO

Yehor Dremliuha3b3636182e81
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 e83ae8c0f..ecedc31c2 100644
--- a/apps/production/src/project/dto/create-project-view.dto.ts
+++ b/apps/production/src/project/dto/create-project-view.dto.ts
@@ -1,5 +1,20 @@
import { ApiProperty } from '@nestjs/swagger'
import { ProjectViewType } from '../entity/project-view.entity'
+import { ProjectViewCustomEventMetaValueType } from '../entity/project-view-custom-event.entity'
+
+export class ProjectViewCustomEventDto {
+ @ApiProperty()
+ customEventName: string
+
+ @ApiProperty()
+ metaKey: string
+
+ @ApiProperty()
+ metaValue: string
+
+ @ApiProperty({ enum: ProjectViewCustomEventMetaValueType })
+ metaValueType: ProjectViewCustomEventMetaValueType
+}
export class CreateProjectViewDto {
@ApiProperty()
@@ -53,4 +68,7 @@ export class CreateProjectViewDto {
@ApiProperty({ description: 'City (Berlin, London, etc.)', nullable: true })
ct: string | null
+
+ @ApiProperty({ type: ProjectViewCustomEventDto, isArray: true })
+ customEvents: ProjectViewCustomEventDto[]
}
diff --git a/apps/production/src/project/entity/project-view-custom-event.entity.ts b/apps/production/src/project/entity/project-view-custom-event.entity.ts
index 8c4f8c4db..67b9e69fc 100644
--- a/apps/production/src/project/entity/project-view-custom-event.entity.ts
+++ b/apps/production/src/project/entity/project-view-custom-event.entity.ts
@@ -9,7 +9,7 @@ import {
} from 'typeorm'
import { ProjectViewEntity } from './project-view.entity'
-export enum MetaValueType {
+export enum ProjectViewCustomEventMetaValueType {
STRING = 'string',
INTEGER = 'integer',
FLOAT = 'float',
@@ -38,8 +38,11 @@ export class ProjectViewCustomEventEntity {
metaValue: string
@ApiProperty()
- @Column('enum', { enum: MetaValueType, default: MetaValueType.STRING })
- metaValueType: MetaValueType
+ @Column('enum', {
+ enum: ProjectViewCustomEventMetaValueType,
+ default: ProjectViewCustomEventMetaValueType.STRING,
+ })
+ metaValueType: ProjectViewCustomEventMetaValueType
@ApiProperty()
@CreateDateColumn()