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!

Add Views Entity and update Project Entity

Yehor Dremliuha5c92cd792a9d
diff --git a/apps/production/src/e-commerce/e-commerce.module.ts b/apps/production/src/e-commerce/e-commerce.module.ts
new file mode 100644
index 000000000..c5832d253
--- /dev/null
+++ b/apps/production/src/e-commerce/e-commerce.module.ts
@@ -0,0 +1,7 @@
+import { Module } from '@nestjs/common';
+import { ViewsModule } from './views/views.module';
+
+@Module({
+ imports: [ViewsModule]
+})
+export class ECommerceModule {}
diff --git a/apps/production/src/e-commerce/views/entities/view.entity.ts b/apps/production/src/e-commerce/views/entities/view.entity.ts
new file mode 100644
index 000000000..5d0b6cf10
--- /dev/null
+++ b/apps/production/src/e-commerce/views/entities/view.entity.ts
@@ -0,0 +1,64 @@
+import { Project } from "../../../project/entity/project.entity";
+import { Column, CreateDateColumn, Entity, ManyToOne, PrimaryGeneratedColumn, UpdateDateColumn } from "typeorm";
+
+@Entity('views')
+export class ViewEntity {
+ @PrimaryGeneratedColumn('uuid')
+ id: string
+
+ @Column()
+ projectId: string
+
+ @Column({ type: 'bigint', nullable: true })
+ psid: string | null
+
+ @Column('varchar')
+ pg: string | null
+
+ @Column('varchar')
+ ev: string
+
+ @Column('varchar', { nullable: true })
+ dv: string | null
+
+ @Column('varchar', { nullable: true })
+ br: string | null
+
+ @Column('varchar', { nullable: true })
+ os: string | null
+
+ @Column('varchar', { nullable: true })
+ lc: string | null
+
+ @Column('varchar', { nullable: true })
+ ref: string | null
+
+ @Column('varchar', { nullable: true })
+ so: string | null
+
+ @Column('varchar', { nullable: true })
+ me: string | null
+
+ @Column('varchar', { nullable: true })
+ ca: string | null
+
+ @Column('varchar', { length: 2, nullable: true })
+ cc: string
+
+ @Column('varchar', { nullable: true })
+ rg: string | null
+
+ @Column('varchar', { nullable: true })
+ ct: string | null
+
+ @CreateDateColumn()
+ createdAt: Date
+
+ @UpdateDateColumn()
+ updatedAt: Date
+
+ @ManyToOne(() => Project, project => project.views)
+ project: Project
+
+}
+
diff --git a/apps/production/src/e-commerce/views/views.module.ts b/apps/production/src/e-commerce/views/views.module.ts
new file mode 100644
index 000000000..5c1b556ce
--- /dev/null
+++ b/apps/production/src/e-commerce/views/views.module.ts
@@ -0,0 +1,8 @@
+import { Module } from '@nestjs/common';
+import { ViewEntity } from './entities/view.entity';
+import { TypeOrmModule } from '@nestjs/typeorm';
+
+@Module({
+ imports: [TypeOrmModule.forFeature([ViewEntity])]
+})
+export class ViewsModule {}
\ No newline at end of file
diff --git a/apps/production/src/project/entity/project.entity.ts b/apps/production/src/project/entity/project.entity.ts
index 8bc49d6a3..ba53d6609 100644
--- a/apps/production/src/project/entity/project.entity.ts
+++ b/apps/production/src/project/entity/project.entity.ts
@@ -15,6 +15,7 @@ import { ExtensionToProject } from '../../marketplace/extensions/entities/extens
import { ProjectSubscriber } from './project-subscriber.entity'
import { Funnel } from './funnel.entity'
import { CAPTCHA_SECRET_KEY_LENGTH } from '../../common/constants'
+import { ViewEntity } from '../../e-commerce/views/entities/view.entity'
// In case of modifying some properties here add them to the GDPR data export email template
@Entity()
@@ -113,4 +114,6 @@ export class Project {
@Column('boolean', { default: false })
isArchived: boolean
+ @OneToMany(() => ViewEntity, view => view.id)
+ views: ViewEntity[]
}