integration tests
This commit is contained in:
43
core/dashboard/application/ports/DashboardEventPublisher.ts
Normal file
43
core/dashboard/application/ports/DashboardEventPublisher.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
/**
|
||||
* Dashboard Event Publisher Port
|
||||
*
|
||||
* Defines the interface for publishing dashboard-related events.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Dashboard accessed event
|
||||
*/
|
||||
export interface DashboardAccessedEvent {
|
||||
type: 'dashboard_accessed';
|
||||
driverId: string;
|
||||
timestamp: Date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dashboard error event
|
||||
*/
|
||||
export interface DashboardErrorEvent {
|
||||
type: 'dashboard_error';
|
||||
driverId: string;
|
||||
error: string;
|
||||
timestamp: Date;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dashboard Event Publisher Interface
|
||||
*
|
||||
* Publishes events related to dashboard operations.
|
||||
*/
|
||||
export interface DashboardEventPublisher {
|
||||
/**
|
||||
* Publish a dashboard accessed event
|
||||
* @param event - The event to publish
|
||||
*/
|
||||
publishDashboardAccessed(event: DashboardAccessedEvent): Promise<void>;
|
||||
|
||||
/**
|
||||
* Publish a dashboard error event
|
||||
* @param event - The event to publish
|
||||
*/
|
||||
publishDashboardError(event: DashboardErrorEvent): Promise<void>;
|
||||
}
|
||||
9
core/dashboard/application/ports/DashboardQuery.ts
Normal file
9
core/dashboard/application/ports/DashboardQuery.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Dashboard Query
|
||||
*
|
||||
* Query object for fetching dashboard data.
|
||||
*/
|
||||
|
||||
export interface DashboardQuery {
|
||||
driverId: string;
|
||||
}
|
||||
107
core/dashboard/application/ports/DashboardRepository.ts
Normal file
107
core/dashboard/application/ports/DashboardRepository.ts
Normal file
@@ -0,0 +1,107 @@
|
||||
/**
|
||||
* Dashboard Repository Port
|
||||
*
|
||||
* Defines the interface for accessing dashboard-related data.
|
||||
* This is a read-only repository for dashboard data aggregation.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Driver data for dashboard display
|
||||
*/
|
||||
export interface DriverData {
|
||||
id: string;
|
||||
name: string;
|
||||
avatar?: string;
|
||||
rating: number;
|
||||
rank: number;
|
||||
starts: number;
|
||||
wins: number;
|
||||
podiums: number;
|
||||
leagues: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Race data for upcoming races section
|
||||
*/
|
||||
export interface RaceData {
|
||||
id: string;
|
||||
trackName: string;
|
||||
carType: string;
|
||||
scheduledDate: Date;
|
||||
timeUntilRace?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* League standing data for championship standings section
|
||||
*/
|
||||
export interface LeagueStandingData {
|
||||
leagueId: string;
|
||||
leagueName: string;
|
||||
position: number;
|
||||
points: number;
|
||||
totalDrivers: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Activity data for recent activity feed
|
||||
*/
|
||||
export interface ActivityData {
|
||||
id: string;
|
||||
type: 'race_result' | 'league_invitation' | 'achievement' | 'other';
|
||||
description: string;
|
||||
timestamp: Date;
|
||||
status: 'success' | 'info' | 'warning' | 'error';
|
||||
}
|
||||
|
||||
/**
|
||||
* Friend data for social section
|
||||
*/
|
||||
export interface FriendData {
|
||||
id: string;
|
||||
name: string;
|
||||
avatar?: string;
|
||||
rating: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dashboard Repository Interface
|
||||
*
|
||||
* Provides access to all data needed for the dashboard.
|
||||
* Each method returns data for a specific driver.
|
||||
*/
|
||||
export interface DashboardRepository {
|
||||
/**
|
||||
* Find a driver by ID
|
||||
* @param driverId - The driver ID
|
||||
* @returns Driver data or null if not found
|
||||
*/
|
||||
findDriverById(driverId: string): Promise<DriverData | null>;
|
||||
|
||||
/**
|
||||
* Get upcoming races for a driver
|
||||
* @param driverId - The driver ID
|
||||
* @returns Array of upcoming races
|
||||
*/
|
||||
getUpcomingRaces(driverId: string): Promise<RaceData[]>;
|
||||
|
||||
/**
|
||||
* Get league standings for a driver
|
||||
* @param driverId - The driver ID
|
||||
* @returns Array of league standings
|
||||
*/
|
||||
getLeagueStandings(driverId: string): Promise<LeagueStandingData[]>;
|
||||
|
||||
/**
|
||||
* Get recent activity for a driver
|
||||
* @param driverId - The driver ID
|
||||
* @returns Array of recent activities
|
||||
*/
|
||||
getRecentActivity(driverId: string): Promise<ActivityData[]>;
|
||||
|
||||
/**
|
||||
* Get friends for a driver
|
||||
* @param driverId - The driver ID
|
||||
* @returns Array of friends
|
||||
*/
|
||||
getFriends(driverId: string): Promise<FriendData[]>;
|
||||
}
|
||||
Reference in New Issue
Block a user