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.2 KB
Raw Blame
import { ApiProperty } from '@nestjs/swagger'
import {
  Column,
  CreateDateColumn,
  Entity,
  ManyToOne,
  PrimaryGeneratedColumn,
  UpdateDateColumn,
} from 'typeorm'
import { ProjectViewEntity } from './project-view.entity'

export enum ProjectViewCustomEventMetaValueType {
  STRING = 'string',
  INTEGER = 'integer',
  FLOAT = 'float',
}

@Entity('projects_views_custom_events')
export class ProjectViewCustomEventEntity {
  @ApiProperty()
  @PrimaryGeneratedColumn('uuid')
  id: string

  @ApiProperty()
  @Column('varchar')
  viewId: string

  @ApiProperty()
  @Column('varchar')
  customEventName: string

  @ApiProperty()
  @Column('varchar', {
    nullable: true,
  })
  metaKey: string

  @ApiProperty()
  @Column('varchar', {
    nullable: true,
  })
  metaValue: string

  @ApiProperty()
  @Column('varchar')
  metricKey: string

  @ApiProperty()
  @Column('enum', {
    enum: ProjectViewCustomEventMetaValueType,
    default: ProjectViewCustomEventMetaValueType.STRING,
  })
  metaValueType: ProjectViewCustomEventMetaValueType

  @ApiProperty()
  @CreateDateColumn()
  createdAt: Date

  @ApiProperty()
  @UpdateDateColumn()
  updatedAt: Date

  @ManyToOne(() => ProjectViewEntity, (projectView) => projectView.customEvents)
  view: ProjectViewEntity
}