website refactor

This commit is contained in:
2026-01-16 13:48:18 +01:00
parent 20a42c52fd
commit 7e02fc3ea5
796 changed files with 1946 additions and 2545 deletions

View File

@@ -1,7 +1,7 @@
import { PageView } from '../../domain/entities/PageView';
import { EntityType } from '../../domain/types/PageView';
export interface IPageViewRepository {
export interface PageViewRepository {
save(pageView: PageView): Promise<void>;
findById(id: string): Promise<PageView | null>;
findByEntityId(entityType: EntityType, entityId: string): Promise<PageView[]>;

View File

@@ -1,7 +1,7 @@
import type { Logger, UseCase } from '@core/shared/application';
import { Result } from '@core/shared/application/Result';
import { Result } from '@core/shared/domain/Result';
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
import type { IPageViewRepository } from '../repositories/IPageViewRepository';
import type { PageViewRepository } from '../repositories/PageViewRepository';
export interface GetAnalyticsMetricsInput {
startDate?: Date;

View File

@@ -1,5 +1,5 @@
import type { Logger, UseCase } from '@core/shared/application';
import { Result } from '@core/shared/application/Result';
import { Result } from '@core/shared/domain/Result';
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
export interface GetDashboardDataInput {}

View File

@@ -1,8 +1,8 @@
import { describe, it, expect, vi, type Mock } from 'vitest';
import { GetEntityAnalyticsQuery, type GetEntityAnalyticsInput } from './GetEntityAnalyticsQuery';
import type { IPageViewRepository } from '../repositories/IPageViewRepository';
import type { IEngagementRepository } from '@core/analytics/domain/repositories/IEngagementRepository';
import type { Logger } from '@core/shared/application';
import type { PageViewRepository } from '../repositories/PageViewRepository';
import type { EngagementRepository } from '@core/analytics/domain/repositories/EngagementRepository';
import type { Logger } from '@core/shared/domain';
import type { EntityType } from '../../domain/types/PageView';
describe('GetEntityAnalyticsQuery', () => {

View File

@@ -6,11 +6,11 @@
*/
import type { AsyncUseCase , Logger } from '@core/shared/application';
import type { IPageViewRepository } from '../repositories/IPageViewRepository';
import type { IEngagementRepository } from '@core/analytics/domain/repositories/IEngagementRepository';
import type { PageViewRepository } from '../repositories/PageViewRepository';
import type { EngagementRepository } from '@core/analytics/domain/repositories/EngagementRepository';
import type { EntityType } from '../../domain/types/PageView';
import type { SnapshotPeriod } from '../../domain/types/AnalyticsSnapshot';
import { Result } from '@core/shared/application/Result';
import { Result } from '@core/shared/domain/Result';
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
export interface GetEntityAnalyticsInput {

View File

@@ -1,6 +1,6 @@
import { describe, it, expect, vi, type Mock } from 'vitest';
import { RecordEngagementUseCase, type RecordEngagementInput } from './RecordEngagementUseCase';
import type { IEngagementRepository } from '../../domain/repositories/IEngagementRepository';
import type { EngagementRepository } from '../../domain/repositories/EngagementRepository';
import { EngagementEvent } from '../../domain/entities/EngagementEvent';
import type { Logger } from '@core/shared/application';
import type { EngagementAction, EngagementEntityType } from '../../domain/types/EngagementEvent';

View File

@@ -1,8 +1,8 @@
import type { Logger, UseCase } from '@core/shared/application';
import { Result } from '@core/shared/application/Result';
import { Result } from '@core/shared/domain/Result';
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
import { EngagementEvent } from '../../domain/entities/EngagementEvent';
import type { IEngagementRepository } from '../../domain/repositories/IEngagementRepository';
import type { EngagementRepository } from '../../domain/repositories/EngagementRepository';
import type { EngagementAction, EngagementEntityType } from '../../domain/types/EngagementEvent';
export interface RecordEngagementInput {

View File

@@ -1,8 +1,8 @@
import type { Logger, UseCase } from '@core/shared/application';
import type { IPageViewRepository } from '../repositories/IPageViewRepository';
import type { PageViewRepository } from '../repositories/PageViewRepository';
import { PageView } from '../../domain/entities/PageView';
import type { EntityType, VisitorType } from '../../domain/types/PageView';
import { Result } from '@core/shared/application/Result';
import { Result } from '@core/shared/domain/Result';
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
export interface RecordPageViewInput {

View File

@@ -5,7 +5,7 @@
* Pre-calculated metrics for sponsor dashboard and entity analytics.
*/
import type { IEntity } from '@core/shared/domain';
import type { Entity } from '@core/shared/domain';
import type {
AnalyticsSnapshotProps,
AnalyticsMetrics,
@@ -15,7 +15,7 @@ import type {
export type { SnapshotEntityType, SnapshotPeriod } from '../types/AnalyticsSnapshot';
import { AnalyticsEntityId } from '../value-objects/AnalyticsEntityId';
export class AnalyticsSnapshot implements IEntity<string> {
export class AnalyticsSnapshot implements Entity<string> {
readonly id: string;
readonly entityType: SnapshotEntityType;
readonly period: SnapshotPeriod;

View File

@@ -5,7 +5,7 @@
* Tracks clicks, downloads, sign-ups, and other engagement actions.
*/
import type { IEntity } from '@core/shared/domain';
import type { Entity } from '@core/shared/domain';
import type {
EngagementAction,
EngagementEntityType,
@@ -15,7 +15,7 @@ import type {
export type { EngagementAction, EngagementEntityType } from '../types/EngagementEvent';
import { AnalyticsEntityId } from '../value-objects/AnalyticsEntityId';
export class EngagementEvent implements IEntity<string> {
export class EngagementEvent implements Entity<string> {
readonly id: string;
readonly action: EngagementAction;
readonly entityType: EngagementEntityType;

View File

@@ -5,7 +5,7 @@
* Captures visitor interactions with leagues, drivers, teams, races.
*/
import type { IEntity } from '@core/shared/domain';
import type { Entity } from '@core/shared/domain';
import type { EntityType, VisitorType, PageViewProps } from '../types/PageView';
export type { EntityType, VisitorType } from '../types/PageView';
@@ -13,7 +13,7 @@ import { AnalyticsEntityId } from '../value-objects/AnalyticsEntityId';
import { AnalyticsSessionId } from '../value-objects/AnalyticsSessionId';
import { PageViewId } from '../value-objects/PageViewId';
export class PageView implements IEntity<string> {
export class PageView implements Entity<string> {
readonly entityType: EntityType;
readonly visitorId: string | undefined;
readonly visitorType: VisitorType;

View File

@@ -6,7 +6,7 @@
import type { AnalyticsSnapshot, SnapshotPeriod, SnapshotEntityType } from '../entities/AnalyticsSnapshot';
export interface IAnalyticsSnapshotRepository {
export interface AnalyticsSnapshotRepository {
save(snapshot: AnalyticsSnapshot): Promise<void>;
findById(id: string): Promise<AnalyticsSnapshot | null>;
findByEntity(entityType: SnapshotEntityType, entityId: string): Promise<AnalyticsSnapshot[]>;

View File

@@ -1,6 +1,6 @@
import type { EngagementEvent, EngagementAction, EngagementEntityType } from '../entities/EngagementEvent';
export interface IEngagementRepository {
export interface EngagementRepository {
save(event: EngagementEvent): Promise<void>;
findById(id: string): Promise<EngagementEvent | null>;
findByEntityId(entityType: EngagementEntityType, entityId: string): Promise<EngagementEvent[]>;

View File

@@ -1,6 +1,6 @@
import type { PageView } from '../entities/PageView';
export interface IPageViewRepository {
export interface PageViewRepository {
save(pageView: PageView): Promise<void>;
findById(id: string): Promise<PageView | null>;
findByEntityId(entityId: string): Promise<PageView[]>;

View File

@@ -1,4 +1,4 @@
import type { IValueObject } from '@core/shared/domain';
import type { ValueObject } from '@core/shared/domain';
export interface AnalyticsEntityIdProps {
value: string;
@@ -10,7 +10,7 @@ export interface AnalyticsEntityIdProps {
* Represents the ID of an entity (league, driver, team, race, sponsor)
* within the analytics bounded context.
*/
export class AnalyticsEntityId implements IValueObject<AnalyticsEntityIdProps> {
export class AnalyticsEntityId implements ValueObject<AnalyticsEntityIdProps> {
public readonly props: AnalyticsEntityIdProps;
private constructor(value: string) {

View File

@@ -1,4 +1,4 @@
import type { IValueObject } from '@core/shared/domain';
import type { ValueObject } from '@core/shared/domain';
export interface AnalyticsSessionIdProps {
value: string;
@@ -9,7 +9,7 @@ export interface AnalyticsSessionIdProps {
*
* Represents an analytics session identifier within the analytics bounded context.
*/
export class AnalyticsSessionId implements IValueObject<AnalyticsSessionIdProps> {
export class AnalyticsSessionId implements ValueObject<AnalyticsSessionIdProps> {
public readonly props: AnalyticsSessionIdProps;
private constructor(value: string) {

View File

@@ -1,4 +1,4 @@
import type { IValueObject } from '@core/shared/domain';
import type { ValueObject } from '@core/shared/domain';
export interface PageViewIdProps {
value: string;
@@ -9,7 +9,7 @@ export interface PageViewIdProps {
*
* Represents the identifier of a PageView within the analytics bounded context.
*/
export class PageViewId implements IValueObject<PageViewIdProps> {
export class PageViewId implements ValueObject<PageViewIdProps> {
public readonly props: PageViewIdProps;
private constructor(value: string) {

View File

@@ -1,23 +0,0 @@
/**
* @gridpilot/analytics
*
* Analytics bounded context - tracks page views, engagement events,
* and generates analytics snapshots for sponsor exposure metrics.
*/
// Domain entities
export * from './domain/entities/PageView';
export * from './domain/entities/EngagementEvent';
export * from './domain/entities/AnalyticsSnapshot';
// Application repositories
export * from './application/repositories/IPageViewRepository';
export * from './domain/repositories/IEngagementRepository';
export * from './domain/repositories/IAnalyticsSnapshotRepository';
// Application use cases
export * from './application/use-cases/RecordPageViewUseCase';
export * from './application/use-cases/RecordEngagementUseCase';
export * from './application/use-cases/GetEntityAnalyticsQuery';
// Infrastructure (moved to adapters)