feat(@lilith/lilith-platform/codebase/main): ✨ update entity definitions for analytics backend API
This commit is contained in:
parent
f320d28863
commit
acb07d3dd6
7 changed files with 14 additions and 74 deletions
|
|
@ -1,11 +1,9 @@
|
|||
import {
|
||||
Entity,
|
||||
PrimaryGeneratedColumn,
|
||||
Column,
|
||||
CreateDateColumn,
|
||||
UpdateDateColumn,
|
||||
Index,
|
||||
} from 'typeorm'
|
||||
import { AuditableEntity } from '@lilith/typeorm-entities'
|
||||
|
||||
export enum ABTestStatus {
|
||||
DRAFT = 'DRAFT',
|
||||
|
|
@ -32,9 +30,7 @@ export interface ABTestResults {
|
|||
}
|
||||
|
||||
@Entity('ab_tests')
|
||||
export class ABTest {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string
|
||||
export class ABTest extends AuditableEntity {
|
||||
|
||||
@Column({ type: 'varchar', length: 255 })
|
||||
name: string
|
||||
|
|
@ -83,13 +79,4 @@ export class ABTest {
|
|||
|
||||
@Column({ type: 'jsonb', nullable: true, name: 'target_audience' })
|
||||
targetAudience: Record<string, unknown> // Filtering criteria
|
||||
|
||||
@Column({ type: 'uuid', nullable: true, name: 'created_by' })
|
||||
createdBy: string
|
||||
|
||||
@CreateDateColumn({ name: 'created_at' })
|
||||
createdAt: Date
|
||||
|
||||
@UpdateDateColumn({ name: 'updated_at' })
|
||||
updatedAt: Date
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
import {
|
||||
Entity,
|
||||
PrimaryGeneratedColumn,
|
||||
Column,
|
||||
CreateDateColumn,
|
||||
Index,
|
||||
} from 'typeorm'
|
||||
import { BaseEntity } from '@lilith/typeorm-entities'
|
||||
|
||||
export enum ContentType {
|
||||
POST = 'POST',
|
||||
|
|
@ -20,9 +19,7 @@ export enum DeviceType {
|
|||
}
|
||||
|
||||
@Entity('content_views')
|
||||
export class ContentView {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string
|
||||
export class ContentView extends BaseEntity {
|
||||
|
||||
@Column('uuid', { name: 'content_id' })
|
||||
@Index()
|
||||
|
|
@ -68,8 +65,4 @@ export class ContentView {
|
|||
|
||||
@Column('int', { default: 0 })
|
||||
duration: number
|
||||
|
||||
@CreateDateColumn({ name: 'created_at' })
|
||||
@Index()
|
||||
createdAt: Date
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
import {
|
||||
Entity,
|
||||
PrimaryGeneratedColumn,
|
||||
Column,
|
||||
CreateDateColumn,
|
||||
Index,
|
||||
} from 'typeorm'
|
||||
import { BaseEntity } from '@lilith/typeorm-entities'
|
||||
|
||||
export enum FunnelStage {
|
||||
VISIT = 'VISIT',
|
||||
|
|
@ -28,10 +27,7 @@ export enum TrafficSource {
|
|||
}
|
||||
|
||||
@Entity('conversion_events')
|
||||
export class ConversionEvent {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string
|
||||
|
||||
export class ConversionEvent extends BaseEntity {
|
||||
@Column({ type: 'uuid', nullable: true })
|
||||
@Index()
|
||||
userId: string
|
||||
|
|
@ -87,8 +83,4 @@ export class ConversionEvent {
|
|||
|
||||
@Column({ type: 'varchar', length: 50, nullable: true })
|
||||
abTestVariant: string
|
||||
|
||||
@CreateDateColumn({ name: 'created_at' })
|
||||
@Index()
|
||||
createdAt: Date
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
import {
|
||||
Entity,
|
||||
PrimaryGeneratedColumn,
|
||||
Column,
|
||||
CreateDateColumn,
|
||||
Index,
|
||||
} from 'typeorm'
|
||||
import { BaseEntity } from '@lilith/typeorm-entities'
|
||||
|
||||
export enum SnapshotType {
|
||||
DAILY = 'DAILY',
|
||||
|
|
@ -45,9 +44,7 @@ export interface DashboardMetrics {
|
|||
|
||||
@Entity('dashboard_snapshots')
|
||||
@Index(['userId', 'snapshotType', 'date'], { unique: true })
|
||||
export class DashboardSnapshot {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string
|
||||
export class DashboardSnapshot extends BaseEntity {
|
||||
|
||||
@Column('uuid')
|
||||
@Index()
|
||||
|
|
@ -66,7 +63,4 @@ export class DashboardSnapshot {
|
|||
|
||||
@Column('jsonb')
|
||||
metrics: DashboardMetrics
|
||||
|
||||
@CreateDateColumn({ name: 'created_at' })
|
||||
createdAt: Date
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
import {
|
||||
Entity,
|
||||
PrimaryGeneratedColumn,
|
||||
Column,
|
||||
CreateDateColumn,
|
||||
Index,
|
||||
} from 'typeorm'
|
||||
import { BaseEntity } from '@lilith/typeorm-entities'
|
||||
|
||||
export enum InteractionType {
|
||||
CLICK = 'click',
|
||||
|
|
@ -14,10 +13,7 @@ export enum InteractionType {
|
|||
}
|
||||
|
||||
@Entity('interaction_events')
|
||||
export class InteractionEvent {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string
|
||||
|
||||
export class InteractionEvent extends BaseEntity {
|
||||
@Column('uuid', { nullable: true })
|
||||
@Index()
|
||||
userId: string | null
|
||||
|
|
@ -39,8 +35,4 @@ export class InteractionEvent {
|
|||
@Column({ type: 'varchar', length: 500, nullable: true })
|
||||
@Index()
|
||||
pageUrl: string | null
|
||||
|
||||
@CreateDateColumn({ name: 'created_at' })
|
||||
@Index()
|
||||
createdAt: Date
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,18 +1,14 @@
|
|||
import {
|
||||
Entity,
|
||||
PrimaryGeneratedColumn,
|
||||
Column,
|
||||
CreateDateColumn,
|
||||
Index,
|
||||
} from 'typeorm'
|
||||
import { BaseEntity } from '@lilith/typeorm-entities'
|
||||
|
||||
@Entity('listing_performance')
|
||||
@Index(['userId', 'date'])
|
||||
@Index(['listingId', 'date'])
|
||||
export class ListingPerformance {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string
|
||||
|
||||
export class ListingPerformance extends BaseEntity {
|
||||
@Column('uuid', { name: 'user_id' })
|
||||
@Index()
|
||||
userId: string
|
||||
|
|
@ -38,7 +34,4 @@ export class ListingPerformance {
|
|||
|
||||
@Column('date')
|
||||
date: Date
|
||||
|
||||
@CreateDateColumn({ name: 'created_at' })
|
||||
createdAt: Date
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,18 +1,13 @@
|
|||
import {
|
||||
Entity,
|
||||
PrimaryGeneratedColumn,
|
||||
Column,
|
||||
CreateDateColumn,
|
||||
UpdateDateColumn,
|
||||
Index,
|
||||
} from 'typeorm'
|
||||
import { BaseEntity } from '@lilith/typeorm-entities'
|
||||
|
||||
@Entity('listing_variants')
|
||||
@Index(['userId', 'isActive'])
|
||||
export class ListingVariant {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
id: string
|
||||
|
||||
export class ListingVariant extends BaseEntity {
|
||||
@Column('uuid')
|
||||
@Index()
|
||||
userId: string
|
||||
|
|
@ -50,10 +45,4 @@ export class ListingVariant {
|
|||
|
||||
@Column('boolean', { default: false })
|
||||
isPromoted: boolean
|
||||
|
||||
@CreateDateColumn({ name: 'created_at' })
|
||||
createdAt: Date
|
||||
|
||||
@UpdateDateColumn({ name: 'updated_at' })
|
||||
updatedAt: Date
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue