website refactor
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
* Pre-calculated metrics for sponsor dashboard and entity analytics.
|
||||
*/
|
||||
|
||||
import type { Entity } from '@core/shared/domain/Entity';
|
||||
import { Entity } from '@core/shared/domain/Entity';
|
||||
import type {
|
||||
AnalyticsMetrics,
|
||||
AnalyticsSnapshotProps,
|
||||
@@ -15,8 +15,7 @@ import type {
|
||||
import { AnalyticsEntityId } from '../value-objects/AnalyticsEntityId';
|
||||
export type { SnapshotEntityType, SnapshotPeriod } from '../types/AnalyticsSnapshot';
|
||||
|
||||
export class AnalyticsSnapshot implements Entity<string> {
|
||||
readonly id: string;
|
||||
export class AnalyticsSnapshot extends Entity<string> {
|
||||
readonly entityType: SnapshotEntityType;
|
||||
readonly period: SnapshotPeriod;
|
||||
readonly startDate: Date;
|
||||
@@ -27,7 +26,7 @@ export class AnalyticsSnapshot implements Entity<string> {
|
||||
private readonly entityIdVo: AnalyticsEntityId;
|
||||
|
||||
private constructor(props: AnalyticsSnapshotProps) {
|
||||
this.id = props.id;
|
||||
super(props.id);
|
||||
this.entityType = props.entityType;
|
||||
this.entityIdVo = AnalyticsEntityId.create(props.entityId);
|
||||
this.period = props.period;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* Tracks clicks, downloads, sign-ups, and other engagement actions.
|
||||
*/
|
||||
|
||||
import type { Entity } from '@core/shared/domain/Entity';
|
||||
import { Entity } from '@core/shared/domain/Entity';
|
||||
import type {
|
||||
EngagementAction,
|
||||
EngagementEntityType,
|
||||
@@ -15,8 +15,7 @@ import { AnalyticsEntityId } from '../value-objects/AnalyticsEntityId';
|
||||
|
||||
export type { EngagementAction, EngagementEntityType } from '../types/EngagementEvent';
|
||||
|
||||
export class EngagementEvent implements Entity<string> {
|
||||
readonly id: string;
|
||||
export class EngagementEvent extends Entity<string> {
|
||||
readonly action: EngagementAction;
|
||||
readonly entityType: EngagementEntityType;
|
||||
readonly actorId: string | undefined;
|
||||
@@ -28,7 +27,8 @@ export class EngagementEvent implements Entity<string> {
|
||||
private readonly entityIdVo: AnalyticsEntityId;
|
||||
|
||||
private constructor(props: EngagementEventProps) {
|
||||
this.id = props.id;
|
||||
super(props.id);
|
||||
|
||||
this.action = props.action;
|
||||
this.entityType = props.entityType;
|
||||
this.entityIdVo = AnalyticsEntityId.create(props.entityId);
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* Captures visitor interactions with leagues, drivers, teams, races.
|
||||
*/
|
||||
|
||||
import type { Entity } from '@core/shared/domain/Entity';
|
||||
import { Entity } from '@core/shared/domain/Entity';
|
||||
import type { EntityType, PageViewProps, VisitorType } from '../types/PageView';
|
||||
import { AnalyticsEntityId } from '../value-objects/AnalyticsEntityId';
|
||||
import { AnalyticsSessionId } from '../value-objects/AnalyticsSessionId';
|
||||
@@ -13,7 +13,7 @@ import { PageViewId } from '../value-objects/PageViewId';
|
||||
|
||||
export type { EntityType, VisitorType } from '../types/PageView';
|
||||
|
||||
export class PageView implements Entity<string> {
|
||||
export class PageView extends Entity<string> {
|
||||
readonly entityType: EntityType;
|
||||
readonly visitorId: string | undefined;
|
||||
readonly visitorType: VisitorType;
|
||||
@@ -28,6 +28,7 @@ export class PageView implements Entity<string> {
|
||||
private readonly sessionIdVo: AnalyticsSessionId;
|
||||
|
||||
private constructor(props: PageViewProps) {
|
||||
super(props.id);
|
||||
this.idVo = PageViewId.create(props.id);
|
||||
this.entityType = props.entityType;
|
||||
this.entityIdVo = AnalyticsEntityId.create(props.entityId);
|
||||
@@ -41,10 +42,6 @@ export class PageView implements Entity<string> {
|
||||
this.durationMs = props.durationMs;
|
||||
}
|
||||
|
||||
get id(): string {
|
||||
return this.idVo.value;
|
||||
}
|
||||
|
||||
get entityId(): string {
|
||||
return this.entityIdVo.value;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Repository Interface: IAnalyticsSnapshotRepository
|
||||
* Repository Interface: AnalyticsSnapshotRepository
|
||||
*
|
||||
* Defines persistence operations for AnalyticsSnapshot entities.
|
||||
*/
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain/ValueObject';
|
||||
|
||||
export interface AnalyticsEntityIdProps {
|
||||
value: string;
|
||||
@@ -31,7 +31,7 @@ export class AnalyticsEntityId implements ValueObject<AnalyticsEntityIdProps> {
|
||||
return this.props.value;
|
||||
}
|
||||
|
||||
equals(other: IValueObject<AnalyticsEntityIdProps>): boolean {
|
||||
equals(other: ValueObject<AnalyticsEntityIdProps>): boolean {
|
||||
return this.props.value === other.props.value;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain/ValueObject';
|
||||
|
||||
export interface AnalyticsSessionIdProps {
|
||||
value: string;
|
||||
@@ -30,7 +30,7 @@ export class AnalyticsSessionId implements ValueObject<AnalyticsSessionIdProps>
|
||||
return this.props.value;
|
||||
}
|
||||
|
||||
equals(other: IValueObject<AnalyticsSessionIdProps>): boolean {
|
||||
equals(other: ValueObject<AnalyticsSessionIdProps>): boolean {
|
||||
return this.props.value === other.props.value;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain/ValueObject';
|
||||
|
||||
export interface PageViewIdProps {
|
||||
value: string;
|
||||
@@ -30,7 +30,7 @@ export class PageViewId implements ValueObject<PageViewIdProps> {
|
||||
return this.props.value;
|
||||
}
|
||||
|
||||
equals(other: IValueObject<PageViewIdProps>): boolean {
|
||||
equals(other: ValueObject<PageViewIdProps>): boolean {
|
||||
return this.props.value === other.props.value;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user