linting
This commit is contained in:
@@ -23,7 +23,7 @@ export class InMemoryAnalyticsSnapshotRepository implements IAnalyticsSnapshotRe
|
||||
this.snapshots.set(snapshot.id, snapshot);
|
||||
this.logger.info(`AnalyticsSnapshot ${snapshot.id} saved successfully.`);
|
||||
} catch (error) {
|
||||
this.logger.error(`Error saving AnalyticsSnapshot ${snapshot.id}:`, error);
|
||||
this.logger.error(`Error saving AnalyticsSnapshot ${snapshot.id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -39,7 +39,7 @@ export class InMemoryAnalyticsSnapshotRepository implements IAnalyticsSnapshotRe
|
||||
}
|
||||
return snapshot;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding AnalyticsSnapshot by ID ${id}:`, error);
|
||||
this.logger.error(`Error finding AnalyticsSnapshot by ID ${id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -53,7 +53,7 @@ export class InMemoryAnalyticsSnapshotRepository implements IAnalyticsSnapshotRe
|
||||
this.logger.info(`Found ${snapshots.length} AnalyticsSnapshots for entity ${entityId}.`);
|
||||
return snapshots;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding AnalyticsSnapshots for entity ${entityId}:`, error);
|
||||
this.logger.error(`Error finding AnalyticsSnapshots for entity ${entityId}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -81,7 +81,7 @@ export class InMemoryAnalyticsSnapshotRepository implements IAnalyticsSnapshotRe
|
||||
}
|
||||
return snapshot;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding AnalyticsSnapshot by period for entity ${entityId}:`, error);
|
||||
this.logger.error(`Error finding AnalyticsSnapshot by period for entity ${entityId}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -105,7 +105,7 @@ export class InMemoryAnalyticsSnapshotRepository implements IAnalyticsSnapshotRe
|
||||
}
|
||||
return snapshot;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding latest AnalyticsSnapshot for entity ${entityId}:`, error);
|
||||
this.logger.error(`Error finding latest AnalyticsSnapshot for entity ${entityId}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -125,7 +125,7 @@ export class InMemoryAnalyticsSnapshotRepository implements IAnalyticsSnapshotRe
|
||||
this.logger.info(`Found ${snapshots.length} historical AnalyticsSnapshots for entity ${entityId}, period ${period}.`);
|
||||
return snapshots;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error getting historical AnalyticsSnapshots for entity ${entityId}:`, error);
|
||||
this.logger.error(`Error getting historical AnalyticsSnapshots for entity ${entityId}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
* In-memory implementation of IEngagementRepository for development/testing.
|
||||
*/
|
||||
|
||||
import type { IEngagementRepository } from '../../domain/repositories/IEngagementRepository';
|
||||
import { EngagementEvent, type EngagementAction, type EngagementEntityType } from '../../domain/entities/EngagementEvent';
|
||||
import type { IEngagementRepository } from '@core/analytics/domain/repositories/IEngagementRepository';
|
||||
import { EngagementEvent, type EngagementAction, type EngagementEntityType } from '@core/analytics/domain/entities/EngagementEvent';
|
||||
import { Logger } from '@core/shared/application';
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ export class InMemoryEngagementRepository implements IEngagementRepository {
|
||||
this.events.set(event.id, event);
|
||||
this.logger.info(`Successfully saved engagement event: ${event.id}`);
|
||||
} catch (error) {
|
||||
this.logger.error(`Error saving engagement event ${event.id}:`, error);
|
||||
this.logger.error(`Error saving engagement event ${event.id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -41,7 +41,7 @@ export class InMemoryEngagementRepository implements IEngagementRepository {
|
||||
}
|
||||
return event;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding engagement event by ID ${id}:`, error);
|
||||
this.logger.error(`Error finding engagement event by ID ${id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -55,7 +55,7 @@ export class InMemoryEngagementRepository implements IEngagementRepository {
|
||||
this.logger.info(`Found ${events.length} engagement events for entityType: ${entityType}, entityId: ${entityId}`);
|
||||
return events;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding engagement events by entity ID ${entityId}:`, error);
|
||||
this.logger.error(`Error finding engagement events by entity ID ${entityId}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -69,7 +69,7 @@ export class InMemoryEngagementRepository implements IEngagementRepository {
|
||||
this.logger.info(`Found ${events.length} engagement events for action: ${action}`);
|
||||
return events;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding engagement events by action ${action}:`, error);
|
||||
this.logger.error(`Error finding engagement events by action ${action}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -83,7 +83,7 @@ export class InMemoryEngagementRepository implements IEngagementRepository {
|
||||
this.logger.info(`Found ${events.length} engagement events for date range.`);
|
||||
return events;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding engagement events by date range:`, error);
|
||||
this.logger.error(`Error finding engagement events by date range:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -99,7 +99,7 @@ export class InMemoryEngagementRepository implements IEngagementRepository {
|
||||
this.logger.info(`Counted ${count} engagement events for action: ${action}, entityId: ${entityId}`);
|
||||
return count;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error counting engagement events by action ${action}:`, error);
|
||||
this.logger.error(`Error counting engagement events by action ${action}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -115,7 +115,7 @@ export class InMemoryEngagementRepository implements IEngagementRepository {
|
||||
this.logger.info(`Counted ${count} sponsor clicks for entity ID: ${entityId}`);
|
||||
return count;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error getting sponsor clicks for entity ID ${entityId}:`, error);
|
||||
this.logger.error(`Error getting sponsor clicks for entity ID ${entityId}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -134,7 +134,7 @@ export class InMemoryEngagementRepository implements IEngagementRepository {
|
||||
events.forEach(e => this.events.set(e.id, e));
|
||||
this.logger.info(`Successfully seeded ${events.length} engagement events.`);
|
||||
} catch (error) {
|
||||
this.logger.error(`Error seeding engagement events:`, error);
|
||||
this.logger.error(`Error seeding engagement events:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
* In-memory implementation of IPageViewRepository for development/testing.
|
||||
*/
|
||||
|
||||
import type { IPageViewRepository } from '../../domain/repositories/IPageViewRepository';
|
||||
import { PageView, type EntityType } from '../../domain/entities/PageView';
|
||||
import type { IPageViewRepository } from '@core/analytics/application/repositories/IPageViewRepository';
|
||||
import { PageView, type EntityType } from '@core/analytics/domain/entities/PageView';
|
||||
import { Logger } from '@core/shared/application';
|
||||
|
||||
export class InMemoryPageViewRepository implements IPageViewRepository {
|
||||
@@ -23,7 +23,7 @@ export class InMemoryPageViewRepository implements IPageViewRepository {
|
||||
this.pageViews.set(pageView.id, pageView);
|
||||
this.logger.info(`Successfully saved page view: ${pageView.id}`);
|
||||
} catch (error) {
|
||||
this.logger.error(`Error saving page view ${pageView.id}:`, error);
|
||||
this.logger.error(`Error saving page view ${pageView.id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -39,7 +39,7 @@ export class InMemoryPageViewRepository implements IPageViewRepository {
|
||||
}
|
||||
return pageView;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding page view by ID ${id}:`, error);
|
||||
this.logger.error(`Error finding page view by ID ${id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -53,7 +53,7 @@ export class InMemoryPageViewRepository implements IPageViewRepository {
|
||||
this.logger.info(`Found ${pageViews.length} page views for entityType: ${entityType}, entityId: ${entityId}`);
|
||||
return pageViews;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding page views by entity ID ${entityId}:`, error);
|
||||
this.logger.error(`Error finding page views by entity ID ${entityId}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -67,7 +67,7 @@ export class InMemoryPageViewRepository implements IPageViewRepository {
|
||||
this.logger.info(`Found ${pageViews.length} page views for date range.`);
|
||||
return pageViews;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding page views by date range:`, error);
|
||||
this.logger.error(`Error finding page views by date range:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -81,7 +81,7 @@ export class InMemoryPageViewRepository implements IPageViewRepository {
|
||||
this.logger.info(`Found ${pageViews.length} page views for session ID: ${sessionId}`);
|
||||
return pageViews;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding page views by session ID ${sessionId}:`, error);
|
||||
this.logger.error(`Error finding page views by session ID ${sessionId}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -97,7 +97,7 @@ export class InMemoryPageViewRepository implements IPageViewRepository {
|
||||
this.logger.info(`Counted ${count} page views for entityType: ${entityType}, entityId: ${entityId}`);
|
||||
return count;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error counting page views by entity ID ${entityId}:`, error);
|
||||
this.logger.error(`Error counting page views by entity ID ${entityId}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -118,7 +118,7 @@ export class InMemoryPageViewRepository implements IPageViewRepository {
|
||||
this.logger.info(`Counted ${visitors.size} unique visitors for entityType: ${entityType}, entityId: ${entityId}`);
|
||||
return visitors.size;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error counting unique visitors for entity ID ${entityId}:`, error);
|
||||
this.logger.error(`Error counting unique visitors for entity ID ${entityId}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -137,7 +137,7 @@ export class InMemoryPageViewRepository implements IPageViewRepository {
|
||||
pageViews.forEach(pv => this.pageViews.set(pv.id, pv));
|
||||
this.logger.info(`Successfully seeded ${pageViews.length} page views.`);
|
||||
} catch (error) {
|
||||
this.logger.error(`Error seeding page views:`, error);
|
||||
this.logger.error(`Error seeding page views:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ export class InMemoryAchievementRepository implements IAchievementRepository {
|
||||
}
|
||||
return achievement;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding achievement by id ${id}:`, error);
|
||||
this.logger.error(`Error finding achievement by id ${id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -69,7 +69,7 @@ export class InMemoryAchievementRepository implements IAchievementRepository {
|
||||
this.logger.info(`Found ${achievements.length} achievements.`);
|
||||
return achievements;
|
||||
} catch (error) {
|
||||
this.logger.error('Error finding all achievements:', error);
|
||||
this.logger.error('Error finding all achievements:', error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -82,7 +82,7 @@ export class InMemoryAchievementRepository implements IAchievementRepository {
|
||||
this.logger.info(`Found ${achievements.length} achievements for category: ${category}.`);
|
||||
return achievements;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding achievements by category ${category}:`, error);
|
||||
this.logger.error(`Error finding achievements by category ${category}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -98,7 +98,7 @@ export class InMemoryAchievementRepository implements IAchievementRepository {
|
||||
this.logger.info(`Achievement ${achievement.id} created successfully.`);
|
||||
return achievement;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error creating achievement ${achievement.id}:`, error);
|
||||
this.logger.error(`Error creating achievement ${achievement.id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -115,7 +115,7 @@ export class InMemoryAchievementRepository implements IAchievementRepository {
|
||||
}
|
||||
return userAchievement;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding user achievement by id ${id}:`, error);
|
||||
this.logger.error(`Error finding user achievement by id ${id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -128,7 +128,7 @@ export class InMemoryAchievementRepository implements IAchievementRepository {
|
||||
this.logger.info(`Found ${userAchievements.length} user achievements for user id: ${userId}.`);
|
||||
return userAchievements;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding user achievements by user id ${userId}:`, error);
|
||||
this.logger.error(`Error finding user achievements by user id ${userId}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -161,7 +161,7 @@ export class InMemoryAchievementRepository implements IAchievementRepository {
|
||||
this.logger.debug(`User ${userId} earned achievement ${achievementId}: ${hasEarned}.`);
|
||||
return hasEarned;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error checking if user ${userId} earned achievement ${achievementId}:`, error);
|
||||
this.logger.error(`Error checking if user ${userId} earned achievement ${achievementId}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -177,7 +177,7 @@ export class InMemoryAchievementRepository implements IAchievementRepository {
|
||||
this.logger.info(`UserAchievement ${userAchievement.id} created successfully.`);
|
||||
return userAchievement;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error creating user achievement ${userAchievement.id}:`, error);
|
||||
this.logger.error(`Error creating user achievement ${userAchievement.id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -193,7 +193,7 @@ export class InMemoryAchievementRepository implements IAchievementRepository {
|
||||
this.logger.info(`UserAchievement ${userAchievement.id} updated successfully.`);
|
||||
return userAchievement;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error updating user achievement ${userAchievement.id}:`, error);
|
||||
this.logger.error(`Error updating user achievement ${userAchievement.id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -227,7 +227,7 @@ export class InMemoryAchievementRepository implements IAchievementRepository {
|
||||
this.logger.info(`Generated achievement leaderboard with ${leaderboard.length} entries.`);
|
||||
return leaderboard;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error getting achievement leaderboard:`, error);
|
||||
this.logger.error(`Error getting achievement leaderboard:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -270,7 +270,7 @@ export class InMemoryAchievementRepository implements IAchievementRepository {
|
||||
this.logger.info(`Generated achievement stats for user ${userId}:`, stats);
|
||||
return stats;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error getting user achievement stats for user ${userId}:`, error);
|
||||
this.logger.error(`Error getting user achievement stats for user ${userId}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ export class InMemorySponsorAccountRepository implements ISponsorAccountReposito
|
||||
this.accounts.set(account.getId().value, account);
|
||||
this.logger.info(`Sponsor account ${account.getId().value} saved successfully.`);
|
||||
} catch (error) {
|
||||
this.logger.error(`Error saving sponsor account ${account.getId().value}:`, error);
|
||||
this.logger.error(`Error saving sponsor account ${account.getId().value}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -43,7 +43,7 @@ export class InMemorySponsorAccountRepository implements ISponsorAccountReposito
|
||||
}
|
||||
return account;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding sponsor account by id ${id.value}:`, error);
|
||||
this.logger.error(`Error finding sponsor account by id ${id.value}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -61,7 +61,7 @@ export class InMemorySponsorAccountRepository implements ISponsorAccountReposito
|
||||
}
|
||||
return account;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding sponsor account by sponsor id ${sponsorId}:`, error);
|
||||
this.logger.error(`Error finding sponsor account by sponsor id ${sponsorId}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -80,7 +80,7 @@ export class InMemorySponsorAccountRepository implements ISponsorAccountReposito
|
||||
}
|
||||
return account;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding sponsor account by email ${email}:`, error);
|
||||
this.logger.error(`Error finding sponsor account by email ${email}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -94,7 +94,7 @@ export class InMemorySponsorAccountRepository implements ISponsorAccountReposito
|
||||
this.logger.warn(`Sponsor account with id ${id.value} not found for deletion.`);
|
||||
}
|
||||
} catch (error) {
|
||||
this.logger.error(`Error deleting sponsor account ${id.value}:`, error);
|
||||
this.logger.error(`Error deleting sponsor account ${id.value}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -116,7 +116,7 @@ export class InMemorySponsorAccountRepository implements ISponsorAccountReposito
|
||||
});
|
||||
this.logger.info(`Successfully seeded ${accounts.length} sponsor accounts.`);
|
||||
} catch (error) {
|
||||
this.logger.error(`Error seeding sponsor accounts:`, error);
|
||||
this.logger.error(`Error seeding sponsor accounts:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ export class InMemoryUserRatingRepository implements IUserRatingRepository {
|
||||
}
|
||||
return rating;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding user rating for user id ${userId}:`, error);
|
||||
this.logger.error(`Error finding user rating for user id ${userId}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -69,7 +69,7 @@ export class InMemoryUserRatingRepository implements IUserRatingRepository {
|
||||
this.logger.info(`User rating for user id ${rating.userId} saved successfully.`);
|
||||
return rating;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error saving user rating for user id ${rating.userId}:`, error);
|
||||
this.logger.error(`Error saving user rating for user id ${rating.userId}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -84,7 +84,7 @@ export class InMemoryUserRatingRepository implements IUserRatingRepository {
|
||||
this.logger.info(`Retrieved ${topDrivers.length} top drivers.`);
|
||||
return topDrivers;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error getting top drivers:`, error);
|
||||
this.logger.error(`Error getting top drivers:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -99,7 +99,7 @@ export class InMemoryUserRatingRepository implements IUserRatingRepository {
|
||||
this.logger.info(`Retrieved ${topTrusted.length} top trusted users.`);
|
||||
return topTrusted;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error getting top trusted users:`, error);
|
||||
this.logger.error(`Error getting top trusted users:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -112,7 +112,7 @@ export class InMemoryUserRatingRepository implements IUserRatingRepository {
|
||||
this.logger.info(`Found ${eligibleStewards.length} eligible stewards.`);
|
||||
return eligibleStewards;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error getting eligible stewards:`, error);
|
||||
this.logger.error(`Error getting eligible stewards:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -125,7 +125,7 @@ export class InMemoryUserRatingRepository implements IUserRatingRepository {
|
||||
this.logger.info(`Found ${ratingsByTier.length} user ratings for driver tier: ${tier}.`);
|
||||
return ratingsByTier;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding user ratings by driver tier ${tier}:`, error);
|
||||
this.logger.error(`Error finding user ratings by driver tier ${tier}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -139,7 +139,7 @@ export class InMemoryUserRatingRepository implements IUserRatingRepository {
|
||||
this.logger.warn(`User rating for user id ${userId} not found for deletion.`);
|
||||
}
|
||||
} catch (error) {
|
||||
this.logger.error(`Error deleting user rating for user id ${userId}:`, error);
|
||||
this.logger.error(`Error deleting user rating for user id ${userId}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
import { Logger } from '@core/shared/application';
|
||||
import type { IUserRepository, StoredUser } from '../../domain/repositories/IUserRepository';
|
||||
import type { IUserRepository, StoredUser } from '@core/identity/domain/repositories/IUserRepository';
|
||||
|
||||
export class InMemoryUserRepository implements IUserRepository {
|
||||
private users: Map<string, StoredUser> = new Map();
|
||||
@@ -38,7 +38,7 @@ export class InMemoryUserRepository implements IUserRepository {
|
||||
}
|
||||
return user;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding user by email ${email}:`, error);
|
||||
this.logger.error(`Error finding user by email ${email}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -54,7 +54,7 @@ export class InMemoryUserRepository implements IUserRepository {
|
||||
}
|
||||
return user;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding user by id ${id}:`, error);
|
||||
this.logger.error(`Error finding user by id ${id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -71,7 +71,7 @@ export class InMemoryUserRepository implements IUserRepository {
|
||||
this.logger.info(`User ${user.id} (${user.email}) created successfully.`);
|
||||
return user;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error creating user ${user.id} (${user.email}):`, error);
|
||||
this.logger.error(`Error creating user ${user.id} (${user.email}):`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -98,7 +98,7 @@ export class InMemoryUserRepository implements IUserRepository {
|
||||
this.logger.info(`User ${user.id} (${user.email}) updated successfully.`);
|
||||
return user;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error updating user ${user.id} (${user.email}):`, error);
|
||||
this.logger.error(`Error updating user ${user.id} (${user.email}):`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -110,7 +110,7 @@ export class InMemoryUserRepository implements IUserRepository {
|
||||
this.logger.debug(`Email ${email} exists: ${exists}.`);
|
||||
return exists;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error checking existence of email ${email}:`, error);
|
||||
this.logger.error(`Error checking existence of email ${email}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ILogger as Logger } from "@gridpilot/core/shared/application";
|
||||
import { Logger } from "@core/shared/application";
|
||||
|
||||
export class ConsoleLogger implements Logger {
|
||||
debug(message: string, ...args: any[]): void {
|
||||
|
||||
@@ -33,7 +33,7 @@ export class InMemoryNotificationRepository implements INotificationRepository {
|
||||
}
|
||||
return notification;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding notification by ID ${id}:`, error);
|
||||
this.logger.error(`Error finding notification by ID ${id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -47,7 +47,7 @@ export class InMemoryNotificationRepository implements INotificationRepository {
|
||||
this.logger.info(`Found ${notifications.length} notifications for recipient ID: ${recipientId}.`);
|
||||
return notifications;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding notifications for recipient ID ${recipientId}:`, error);
|
||||
this.logger.error(`Error finding notifications for recipient ID ${recipientId}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -61,7 +61,7 @@ export class InMemoryNotificationRepository implements INotificationRepository {
|
||||
this.logger.info(`Found ${notifications.length} unread notifications for recipient ID: ${recipientId}.`);
|
||||
return notifications;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding unread notifications for recipient ID ${recipientId}:`, error);
|
||||
this.logger.error(`Error finding unread notifications for recipient ID ${recipientId}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -89,7 +89,7 @@ export class InMemoryNotificationRepository implements INotificationRepository {
|
||||
this.logger.info(`Counted ${count} unread notifications for recipient ID: ${recipientId}.`);
|
||||
return count;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error counting unread notifications for recipient ID ${recipientId}:`, error);
|
||||
this.logger.error(`Error counting unread notifications for recipient ID ${recipientId}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -104,7 +104,7 @@ export class InMemoryNotificationRepository implements INotificationRepository {
|
||||
this.notifications.set(notification.id, notification);
|
||||
this.logger.info(`Notification ${notification.id} created successfully.`);
|
||||
} catch (error) {
|
||||
this.logger.error(`Error creating notification ${notification.id}:`, error);
|
||||
this.logger.error(`Error creating notification ${notification.id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -119,7 +119,7 @@ export class InMemoryNotificationRepository implements INotificationRepository {
|
||||
this.notifications.set(notification.id, notification);
|
||||
this.logger.info(`Notification ${notification.id} updated successfully.`);
|
||||
} catch (error) {
|
||||
this.logger.error(`Error updating notification ${notification.id}:`, error);
|
||||
this.logger.error(`Error updating notification ${notification.id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -133,7 +133,7 @@ export class InMemoryNotificationRepository implements INotificationRepository {
|
||||
this.logger.warn(`Notification with ID ${id} not found for deletion.`);
|
||||
}
|
||||
} catch (error) {
|
||||
this.logger.error(`Error deleting notification ${id}:`, error);
|
||||
this.logger.error(`Error deleting notification ${id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -149,7 +149,7 @@ export class InMemoryNotificationRepository implements INotificationRepository {
|
||||
toDelete.forEach(id => this.notifications.delete(id));
|
||||
this.logger.info(`Deleted ${toDelete.length} notifications for recipient ID: ${recipientId}.`);
|
||||
} catch (error) {
|
||||
this.logger.error(`Error deleting all notifications for recipient ID ${recipientId}:`, error);
|
||||
this.logger.error(`Error deleting all notifications for recipient ID ${recipientId}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -168,7 +168,7 @@ export class InMemoryNotificationRepository implements INotificationRepository {
|
||||
});
|
||||
this.logger.info(`Marked ${toUpdate.length} notifications as read for recipient ID: ${recipientId}.`);
|
||||
} catch (error) {
|
||||
this.logger.error(`Error marking all notifications as read for recipient ID ${recipientId}:`, error);
|
||||
this.logger.error(`Error marking all notifications as read for recipient ID ${recipientId}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ export class InMemoryCarRepository implements ICarRepository {
|
||||
}
|
||||
return car;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding car by ID ${id}:`, error);
|
||||
this.logger.error(`Error finding car by ID ${id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -52,7 +52,7 @@ export class InMemoryCarRepository implements ICarRepository {
|
||||
this.logger.info(`Successfully found ${cars.length} cars.`);
|
||||
return cars;
|
||||
} catch (error) {
|
||||
this.logger.error('Error finding all cars:', error);
|
||||
this.logger.error('Error finding all cars:', error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -66,7 +66,7 @@ export class InMemoryCarRepository implements ICarRepository {
|
||||
this.logger.info(`Successfully found ${cars.length} cars for game ID: ${gameId}.`);
|
||||
return cars;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding cars by game ID ${gameId}:`, error);
|
||||
this.logger.error(`Error finding cars by game ID ${gameId}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -80,7 +80,7 @@ export class InMemoryCarRepository implements ICarRepository {
|
||||
this.logger.info(`Successfully found ${cars.length} cars for class: ${carClass}.`);
|
||||
return cars;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding cars by class ${carClass}:`, error);
|
||||
this.logger.error(`Error finding cars by class ${carClass}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -94,7 +94,7 @@ export class InMemoryCarRepository implements ICarRepository {
|
||||
this.logger.info(`Successfully found ${cars.length} cars for license: ${license}.`);
|
||||
return cars;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding cars by license ${license}:`, error);
|
||||
this.logger.error(`Error finding cars by license ${license}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -109,7 +109,7 @@ export class InMemoryCarRepository implements ICarRepository {
|
||||
this.logger.info(`Successfully found ${cars.length} cars for manufacturer: ${manufacturer}.`);
|
||||
return cars;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding cars by manufacturer ${manufacturer}:`, error);
|
||||
this.logger.error(`Error finding cars by manufacturer ${manufacturer}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -128,7 +128,7 @@ export class InMemoryCarRepository implements ICarRepository {
|
||||
this.logger.info(`Successfully found ${cars.length} cars matching search query: ${query}.`);
|
||||
return cars;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error searching cars by name query ${query}:`, error);
|
||||
this.logger.error(`Error searching cars by name query ${query}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -145,7 +145,7 @@ export class InMemoryCarRepository implements ICarRepository {
|
||||
this.logger.info(`Car ${car.id} created successfully.`);
|
||||
return car;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error creating car ${car.id}:`, error);
|
||||
this.logger.error(`Error creating car ${car.id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -162,7 +162,7 @@ export class InMemoryCarRepository implements ICarRepository {
|
||||
this.logger.info(`Car ${car.id} updated successfully.`);
|
||||
return car;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error updating car ${car.id}:`, error);
|
||||
this.logger.error(`Error updating car ${car.id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -178,7 +178,7 @@ export class InMemoryCarRepository implements ICarRepository {
|
||||
this.cars.delete(id);
|
||||
this.logger.info(`Car ${id} deleted successfully.`);
|
||||
} catch (error) {
|
||||
this.logger.error(`Error deleting car ${id}:`, error);
|
||||
this.logger.error(`Error deleting car ${id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -190,7 +190,7 @@ export class InMemoryCarRepository implements ICarRepository {
|
||||
this.logger.info(`Car with ID ${id} existence check: ${exists}.`);
|
||||
return exists;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error checking existence of car with ID ${id}:`, error);
|
||||
this.logger.error(`Error checking existence of car with ID ${id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ export class InMemoryLeagueWalletRepository implements ILeagueWalletRepository {
|
||||
}
|
||||
return wallet;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding league wallet by id ${id}:`, error);
|
||||
this.logger.error(`Error finding league wallet by id ${id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -49,7 +49,7 @@ export class InMemoryLeagueWalletRepository implements ILeagueWalletRepository {
|
||||
this.logger.warn(`No league wallet found for league id: ${leagueId}.`);
|
||||
return null;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding league wallet by league id ${leagueId}:`, error);
|
||||
this.logger.error(`Error finding league wallet by league id ${leagueId}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -65,7 +65,7 @@ export class InMemoryLeagueWalletRepository implements ILeagueWalletRepository {
|
||||
this.logger.info(`LeagueWallet ${wallet.id} created successfully.`);
|
||||
return wallet;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error creating league wallet ${wallet.id}:`, error);
|
||||
this.logger.error(`Error creating league wallet ${wallet.id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -81,7 +81,7 @@ export class InMemoryLeagueWalletRepository implements ILeagueWalletRepository {
|
||||
this.logger.info(`LeagueWallet ${wallet.id} updated successfully.`);
|
||||
return wallet;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error updating league wallet ${wallet.id}:`, error);
|
||||
this.logger.error(`Error updating league wallet ${wallet.id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -95,7 +95,7 @@ export class InMemoryLeagueWalletRepository implements ILeagueWalletRepository {
|
||||
this.logger.warn(`LeagueWallet with id ${id} not found for deletion.`);
|
||||
}
|
||||
} catch (error) {
|
||||
this.logger.error(`Error deleting league wallet ${id}:`, error);
|
||||
this.logger.error(`Error deleting league wallet ${id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -107,7 +107,7 @@ export class InMemoryLeagueWalletRepository implements ILeagueWalletRepository {
|
||||
this.logger.debug(`LeagueWallet ${id} exists: ${exists}.`);
|
||||
return exists;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error checking existence of league wallet with id ${id}:`, error);
|
||||
this.logger.error(`Error checking existence of league wallet with id ${id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ export class InMemoryLiveryRepository implements ILiveryRepository {
|
||||
}
|
||||
return livery;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding driver livery by id ${id}:`, error);
|
||||
this.logger.error(`Error finding driver livery by id ${id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -51,7 +51,7 @@ export class InMemoryLiveryRepository implements ILiveryRepository {
|
||||
this.logger.info(`Found ${liveries.length} driver liveries for driver id: ${driverId}.`);
|
||||
return liveries;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding driver liveries by driver id ${driverId}:`, error);
|
||||
this.logger.error(`Error finding driver liveries by driver id ${driverId}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -80,7 +80,7 @@ export class InMemoryLiveryRepository implements ILiveryRepository {
|
||||
this.logger.info(`Found ${liveries.length} driver liveries for game id: ${gameId}.`);
|
||||
return liveries;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding driver liveries by game id ${gameId}:`, error);
|
||||
this.logger.error(`Error finding driver liveries by game id ${gameId}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -110,7 +110,7 @@ export class InMemoryLiveryRepository implements ILiveryRepository {
|
||||
this.logger.info(`DriverLivery ${livery.id} created successfully.`);
|
||||
return livery;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error creating driver livery ${livery.id}:`, error);
|
||||
this.logger.error(`Error creating driver livery ${livery.id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -126,7 +126,7 @@ export class InMemoryLiveryRepository implements ILiveryRepository {
|
||||
this.logger.info(`DriverLivery ${livery.id} updated successfully.`);
|
||||
return livery;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error updating driver livery ${livery.id}:`, error);
|
||||
this.logger.error(`Error updating driver livery ${livery.id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -140,7 +140,7 @@ export class InMemoryLiveryRepository implements ILiveryRepository {
|
||||
this.logger.warn(`DriverLivery with id ${id} not found for deletion.`);
|
||||
}
|
||||
} catch (error) {
|
||||
this.logger.error(`Error deleting driver livery ${id}:`, error);
|
||||
this.logger.error(`Error deleting driver livery ${id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -157,7 +157,7 @@ export class InMemoryLiveryRepository implements ILiveryRepository {
|
||||
}
|
||||
return template;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding livery template by id ${id}:`, error);
|
||||
this.logger.error(`Error finding livery template by id ${id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -169,7 +169,7 @@ export class InMemoryLiveryRepository implements ILiveryRepository {
|
||||
this.logger.info(`Found ${templates.length} livery templates for season id: ${seasonId}.`);
|
||||
return templates;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding livery templates by season id ${seasonId}:`, error);
|
||||
this.logger.error(`Error finding livery templates by season id ${seasonId}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -202,7 +202,7 @@ export class InMemoryLiveryRepository implements ILiveryRepository {
|
||||
this.logger.info(`LiveryTemplate ${template.id} created successfully.`);
|
||||
return template;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error creating livery template ${template.id}:`, error);
|
||||
this.logger.error(`Error creating livery template ${template.id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -218,7 +218,7 @@ export class InMemoryLiveryRepository implements ILiveryRepository {
|
||||
this.logger.info(`LiveryTemplate ${template.id} updated successfully.`);
|
||||
return template;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error updating livery template ${template.id}:`, error);
|
||||
this.logger.error(`Error updating livery template ${template.id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -232,7 +232,7 @@ export class InMemoryLiveryRepository implements ILiveryRepository {
|
||||
this.logger.warn(`LiveryTemplate with id ${id} not found for deletion.`);
|
||||
}
|
||||
} catch (error) {
|
||||
this.logger.error(`Error deleting livery template ${id}:`, error);
|
||||
this.logger.error(`Error deleting livery template ${id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ export class InMemoryPenaltyRepository implements IPenaltyRepository {
|
||||
}
|
||||
return penalty;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding penalty by id ${id}:`, error);
|
||||
this.logger.error(`Error finding penalty by id ${id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -46,7 +46,7 @@ export class InMemoryPenaltyRepository implements IPenaltyRepository {
|
||||
this.logger.info(`Found ${penalties.length} penalties for race id: ${raceId}.`);
|
||||
return penalties;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding penalties by race id ${raceId}:`, error);
|
||||
this.logger.error(`Error finding penalties by race id ${raceId}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -60,7 +60,7 @@ export class InMemoryPenaltyRepository implements IPenaltyRepository {
|
||||
this.logger.info(`Found ${penalties.length} penalties for driver id: ${driverId}.`);
|
||||
return penalties;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding penalties by driver id ${driverId}:`, error);
|
||||
this.logger.error(`Error finding penalties by driver id ${driverId}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -74,7 +74,7 @@ export class InMemoryPenaltyRepository implements IPenaltyRepository {
|
||||
this.logger.info(`Found ${penalties.length} penalties for protest id: ${protestId}.`);
|
||||
return penalties;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding penalties by protest id ${protestId}:`, error);
|
||||
this.logger.error(`Error finding penalties by protest id ${protestId}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -88,7 +88,7 @@ export class InMemoryPenaltyRepository implements IPenaltyRepository {
|
||||
this.logger.info(`Found ${penalties.length} pending penalties.`);
|
||||
return penalties;
|
||||
} catch (error) {
|
||||
this.logger.error('Error finding pending penalties:', error);
|
||||
this.logger.error('Error finding pending penalties:', error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -102,7 +102,7 @@ export class InMemoryPenaltyRepository implements IPenaltyRepository {
|
||||
this.logger.info(`Found ${penalties.length} penalties issued by steward: ${stewardId}.`);
|
||||
return penalties;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding penalties issued by steward ${stewardId}:`, error);
|
||||
this.logger.error(`Error finding penalties issued by steward ${stewardId}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -117,7 +117,7 @@ export class InMemoryPenaltyRepository implements IPenaltyRepository {
|
||||
this.penalties.set(penalty.id, penalty);
|
||||
this.logger.info(`Penalty ${penalty.id} created successfully.`);
|
||||
} catch (error) {
|
||||
this.logger.error(`Error creating penalty ${penalty.id}:`, error);
|
||||
this.logger.error(`Error creating penalty ${penalty.id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -132,7 +132,7 @@ export class InMemoryPenaltyRepository implements IPenaltyRepository {
|
||||
this.penalties.set(penalty.id, penalty);
|
||||
this.logger.info(`Penalty ${penalty.id} updated successfully.`);
|
||||
} catch (error) {
|
||||
this.logger.error(`Error updating penalty ${penalty.id}:`, error);
|
||||
this.logger.error(`Error updating penalty ${penalty.id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -144,7 +144,7 @@ export class InMemoryPenaltyRepository implements IPenaltyRepository {
|
||||
this.logger.debug(`Penalty ${id} exists: ${exists}.`);
|
||||
return exists;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error checking existence of penalty with id ${id}:`, error);
|
||||
this.logger.error(`Error checking existence of penalty with id ${id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ export class InMemoryRaceEventRepository implements IRaceEventRepository {
|
||||
}
|
||||
return event;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding race event by id ${id}:`, error);
|
||||
this.logger.error(`Error finding race event by id ${id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -41,7 +41,7 @@ export class InMemoryRaceEventRepository implements IRaceEventRepository {
|
||||
this.logger.info(`Found ${events.length} race events.`);
|
||||
return events;
|
||||
} catch (error) {
|
||||
this.logger.error('Error finding all race events:', error);
|
||||
this.logger.error('Error finding all race events:', error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -55,7 +55,7 @@ export class InMemoryRaceEventRepository implements IRaceEventRepository {
|
||||
this.logger.info(`Found ${events.length} race events for season id: ${seasonId}.`);
|
||||
return events;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding race events by season id ${seasonId}:`, error);
|
||||
this.logger.error(`Error finding race events by season id ${seasonId}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -69,7 +69,7 @@ export class InMemoryRaceEventRepository implements IRaceEventRepository {
|
||||
this.logger.info(`Found ${events.length} race events for league id: ${leagueId}.`);
|
||||
return events;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding race events by league id ${leagueId}:`, error);
|
||||
this.logger.error(`Error finding race events by league id ${leagueId}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -83,7 +83,7 @@ export class InMemoryRaceEventRepository implements IRaceEventRepository {
|
||||
this.logger.info(`Found ${events.length} race events with status: ${status}.`);
|
||||
return events;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding race events by status ${status}:`, error);
|
||||
this.logger.error(`Error finding race events by status ${status}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -101,7 +101,7 @@ export class InMemoryRaceEventRepository implements IRaceEventRepository {
|
||||
this.logger.info(`Found ${events.length} race events awaiting stewarding close.`);
|
||||
return events;
|
||||
} catch (error) {
|
||||
this.logger.error('Error finding race events awaiting stewarding close:', error);
|
||||
this.logger.error('Error finding race events awaiting stewarding close:', error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -113,7 +113,7 @@ export class InMemoryRaceEventRepository implements IRaceEventRepository {
|
||||
this.logger.info(`Race event ${raceEvent.id} created successfully.`);
|
||||
return raceEvent;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error creating race event ${raceEvent.id}:`, error);
|
||||
this.logger.error(`Error creating race event ${raceEvent.id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -128,7 +128,7 @@ export class InMemoryRaceEventRepository implements IRaceEventRepository {
|
||||
this.logger.info(`Race event ${raceEvent.id} updated successfully.`);
|
||||
return raceEvent;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error updating race event ${raceEvent.id}:`, error);
|
||||
this.logger.error(`Error updating race event ${raceEvent.id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -142,7 +142,7 @@ export class InMemoryRaceEventRepository implements IRaceEventRepository {
|
||||
this.logger.warn(`Race event with id ${id} not found for deletion.`);
|
||||
}
|
||||
} catch (error) {
|
||||
this.logger.error(`Error deleting race event ${id}:`, error);
|
||||
this.logger.error(`Error deleting race event ${id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -154,7 +154,7 @@ export class InMemoryRaceEventRepository implements IRaceEventRepository {
|
||||
this.logger.debug(`Race event ${id} exists: ${exists}.`);
|
||||
return exists;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error checking existence of race event with id ${id}:`, error);
|
||||
this.logger.error(`Error checking existence of race event with id ${id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -173,7 +173,7 @@ export class InMemoryRaceEventRepository implements IRaceEventRepository {
|
||||
this.logger.info(`Retrieved ${events.length} race events.`);
|
||||
return events;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error getting all race events:`, error);
|
||||
this.logger.error(`Error getting all race events:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ export class InMemoryResultRepository implements IResultRepository {
|
||||
}
|
||||
return result;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding result by id ${id}:`, error);
|
||||
this.logger.error(`Error finding result by id ${id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -53,7 +53,7 @@ export class InMemoryResultRepository implements IResultRepository {
|
||||
this.logger.info(`Found ${results.length} results.`);
|
||||
return results;
|
||||
} catch (error) {
|
||||
this.logger.error('Error finding all results:', error);
|
||||
this.logger.error('Error finding all results:', error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -67,7 +67,7 @@ export class InMemoryResultRepository implements IResultRepository {
|
||||
this.logger.info(`Found ${results.length} results for race id: ${raceId}.`);
|
||||
return results;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding results for race id ${raceId}:`, error);
|
||||
this.logger.error(`Error finding results for race id ${raceId}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -80,7 +80,7 @@ export class InMemoryResultRepository implements IResultRepository {
|
||||
this.logger.info(`Found ${results.length} results for driver id: ${driverId}.`);
|
||||
return results;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding results for driver id ${driverId}:`, error);
|
||||
this.logger.error(`Error finding results for driver id ${driverId}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -105,7 +105,7 @@ export class InMemoryResultRepository implements IResultRepository {
|
||||
this.logger.info(`Found ${results.length} results for driver ${driverId} in league ${leagueId}.`);
|
||||
return results;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding results for driver ${driverId} and league ${leagueId}:`, error);
|
||||
this.logger.error(`Error finding results for driver ${driverId} and league ${leagueId}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -122,7 +122,7 @@ export class InMemoryResultRepository implements IResultRepository {
|
||||
this.logger.info(`Result ${result.id} created successfully.`);
|
||||
return result;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error creating result ${result.id}:`, error);
|
||||
this.logger.error(`Error creating result ${result.id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -145,7 +145,7 @@ export class InMemoryResultRepository implements IResultRepository {
|
||||
|
||||
return created;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error creating many results:`, error);
|
||||
this.logger.error(`Error creating many results:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -162,7 +162,7 @@ export class InMemoryResultRepository implements IResultRepository {
|
||||
this.logger.info(`Result ${result.id} updated successfully.`);
|
||||
return result;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error updating result ${result.id}:`, error);
|
||||
this.logger.error(`Error updating result ${result.id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -178,7 +178,7 @@ export class InMemoryResultRepository implements IResultRepository {
|
||||
this.results.delete(id);
|
||||
this.logger.info(`Result ${id} deleted successfully.`);
|
||||
} catch (error) {
|
||||
this.logger.error(`Error deleting result ${id}:`, error);
|
||||
this.logger.error(`Error deleting result ${id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -195,7 +195,7 @@ export class InMemoryResultRepository implements IResultRepository {
|
||||
});
|
||||
this.logger.info(`Deleted ${raceResults.length} results for race id: ${raceId}.`);
|
||||
} catch (error) {
|
||||
this.logger.error(`Error deleting results for race id ${raceId}:`, error);
|
||||
this.logger.error(`Error deleting results for race id ${raceId}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -207,7 +207,7 @@ export class InMemoryResultRepository implements IResultRepository {
|
||||
this.logger.debug(`Result ${id} exists: ${exists}.`);
|
||||
return exists;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error checking existence of result with id ${id}:`, error);
|
||||
this.logger.error(`Error checking existence of result with id ${id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -221,7 +221,7 @@ export class InMemoryResultRepository implements IResultRepository {
|
||||
this.logger.debug(`Results for race ${raceId} exist: ${exists}.`);
|
||||
return exists;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error checking existence of results for race id ${raceId}:`, error);
|
||||
this.logger.error(`Error checking existence of results for race id ${raceId}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
|
||||
|
||||
@@ -283,7 +283,7 @@ export class InMemoryGameRepository implements IGameRepository {
|
||||
}
|
||||
return game;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding game by id ${id}:`, error);
|
||||
this.logger.error(`Error finding game by id ${id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -295,7 +295,7 @@ export class InMemoryGameRepository implements IGameRepository {
|
||||
this.logger.info(`Found ${games.length} games.`);
|
||||
return games;
|
||||
} catch (error) {
|
||||
this.logger.error('Error finding all games:', error);
|
||||
this.logger.error('Error finding all games:', error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -306,7 +306,7 @@ export class InMemoryGameRepository implements IGameRepository {
|
||||
this.games.push(game);
|
||||
this.logger.info(`Game ${game.id} seeded successfully.`);
|
||||
} catch (error) {
|
||||
this.logger.error(`Error seeding game ${game.id}:`, error);
|
||||
this.logger.error(`Error seeding game ${game.id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -333,7 +333,7 @@ export class InMemorySeasonRepository implements ISeasonRepository {
|
||||
}
|
||||
return season;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding season by id ${id}:`, error);
|
||||
this.logger.error(`Error finding season by id ${id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -345,7 +345,7 @@ export class InMemorySeasonRepository implements ISeasonRepository {
|
||||
this.logger.info(`Found ${seasons.length} seasons for league id: ${leagueId}.`);
|
||||
return seasons;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding seasons by league id ${leagueId}:`, error);
|
||||
this.logger.error(`Error finding seasons by league id ${leagueId}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -358,7 +358,7 @@ export class InMemorySeasonRepository implements ISeasonRepository {
|
||||
this.logger.info(`Season ${season.id} created successfully.`);
|
||||
return season;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error creating season ${season.id}:`, error);
|
||||
this.logger.error(`Error creating season ${season.id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -369,7 +369,7 @@ export class InMemorySeasonRepository implements ISeasonRepository {
|
||||
this.seasons.push(season);
|
||||
this.logger.info(`Season ${season.id} added successfully.`);
|
||||
} catch (error) {
|
||||
this.logger.error(`Error adding season ${season.id}:`, error);
|
||||
this.logger.error(`Error adding season ${season.id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -386,7 +386,7 @@ export class InMemorySeasonRepository implements ISeasonRepository {
|
||||
this.seasons[index] = season;
|
||||
this.logger.info(`Season ${season.id} updated successfully.`);
|
||||
} catch (error) {
|
||||
this.logger.error(`Error updating season ${season.id}:`, error);
|
||||
this.logger.error(`Error updating season ${season.id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -398,7 +398,7 @@ export class InMemorySeasonRepository implements ISeasonRepository {
|
||||
this.logger.info(`Found ${seasons.length} seasons for league id: ${leagueId}.`);
|
||||
return seasons;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error listing seasons by league id ${leagueId}:`, error);
|
||||
this.logger.error(`Error listing seasons by league id ${leagueId}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -412,7 +412,7 @@ export class InMemorySeasonRepository implements ISeasonRepository {
|
||||
this.logger.info(`Found ${seasons.length} active seasons for league id: ${leagueId}.`);
|
||||
return seasons;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error listing active seasons by league id ${leagueId}:`, error);
|
||||
this.logger.error(`Error listing active seasons by league id ${leagueId}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -423,7 +423,7 @@ export class InMemorySeasonRepository implements ISeasonRepository {
|
||||
this.seasons.push(season);
|
||||
this.logger.info(`Season ${season.id} seeded successfully.`);
|
||||
} catch (error) {
|
||||
this.logger.error(`Error seeding season ${season.id}:`, error);
|
||||
this.logger.error(`Error seeding season ${season.id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -452,7 +452,7 @@ export class InMemoryLeagueScoringConfigRepository
|
||||
}
|
||||
return config;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding league scoring config for seasonId ${seasonId}:`, error);
|
||||
this.logger.error(`Error finding league scoring config for seasonId ${seasonId}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -472,7 +472,7 @@ export class InMemoryLeagueScoringConfigRepository
|
||||
}
|
||||
return config;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error saving league scoring config ${config.id}:`, error);
|
||||
this.logger.error(`Error saving league scoring config ${config.id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -483,7 +483,7 @@ export class InMemoryLeagueScoringConfigRepository
|
||||
this.configs.push(config);
|
||||
this.logger.info(`League scoring config ${config.id} seeded successfully.`);
|
||||
} catch (error) {
|
||||
this.logger.error(`Error seeding league scoring config ${config.id}:`, error);
|
||||
this.logger.error(`Error seeding league scoring config ${config.id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -524,7 +524,7 @@ export class InMemoryChampionshipStandingRepository
|
||||
this.standings = standings;
|
||||
this.logger.info(`${standings.length} championship standings saved.`);
|
||||
} catch (error) {
|
||||
this.logger.error(`Error saving championship standings:`, error);
|
||||
this.logger.error(`Error saving championship standings:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -535,7 +535,7 @@ export class InMemoryChampionshipStandingRepository
|
||||
this.standings.push(standing);
|
||||
this.logger.info(`Championship standing ${standing.id} seeded successfully.`);
|
||||
} catch (error) {
|
||||
this.logger.error(`Error seeding championship standing ${standing.id}:`, error);
|
||||
this.logger.error(`Error seeding championship standing ${standing.id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -547,7 +547,7 @@ export class InMemoryChampionshipStandingRepository
|
||||
this.logger.info(`Retrieved ${standings.length} championship standings.`);
|
||||
return standings;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error getting all championship standings:`, error);
|
||||
this.logger.error(`Error getting all championship standings:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
* Mock repository for testing and development
|
||||
*/
|
||||
|
||||
import type { SeasonSponsorship, SponsorshipTier } from '../../domain/entities/SeasonSponsorship';
|
||||
import type { ISeasonSponsorshipRepository } from '../../domain/repositories/ISeasonSponsorshipRepository';
|
||||
import type { SeasonSponsorship, SponsorshipTier } from '@core/racing/domain/entities/SeasonSponsorship';
|
||||
import type { ISeasonSponsorshipRepository } from '@core/racing/domain/repositories/ISeasonSponsorshipRepository';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
|
||||
export class InMemorySeasonSponsorshipRepository implements ISeasonSponsorshipRepository {
|
||||
@@ -31,7 +31,7 @@ export class InMemorySeasonSponsorshipRepository implements ISeasonSponsorshipRe
|
||||
}
|
||||
return sponsorship;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding season sponsorship by id ${id}:`, error);
|
||||
this.logger.error(`Error finding season sponsorship by id ${id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -43,7 +43,7 @@ export class InMemorySeasonSponsorshipRepository implements ISeasonSponsorshipRe
|
||||
this.logger.info(`Found ${sponsorships.length} season sponsorships for season id: ${seasonId}.`);
|
||||
return sponsorships;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding season sponsorships by season id ${seasonId}:`, error);
|
||||
this.logger.error(`Error finding season sponsorships by season id ${seasonId}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -55,7 +55,7 @@ export class InMemorySeasonSponsorshipRepository implements ISeasonSponsorshipRe
|
||||
this.logger.info(`Found ${sponsorships.length} season sponsorships for league id: ${leagueId}.`);
|
||||
return sponsorships;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding season sponsorships by league id ${leagueId}:`, error);
|
||||
this.logger.error(`Error finding season sponsorships by league id ${leagueId}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -67,7 +67,7 @@ export class InMemorySeasonSponsorshipRepository implements ISeasonSponsorshipRe
|
||||
this.logger.info(`Found ${sponsorships.length} season sponsorships for sponsor id: ${sponsorId}.`);
|
||||
return sponsorships;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding season sponsorships by sponsor id ${sponsorId}:`, error);
|
||||
this.logger.error(`Error finding season sponsorships by sponsor id ${sponsorId}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -97,7 +97,7 @@ export class InMemorySeasonSponsorshipRepository implements ISeasonSponsorshipRe
|
||||
this.logger.info(`SeasonSponsorship ${sponsorship.id} created successfully.`);
|
||||
return sponsorship;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error creating season sponsorship ${sponsorship.id}:`, error);
|
||||
this.logger.error(`Error creating season sponsorship ${sponsorship.id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -113,7 +113,7 @@ export class InMemorySeasonSponsorshipRepository implements ISeasonSponsorshipRe
|
||||
this.logger.info(`SeasonSponsorship ${sponsorship.id} updated successfully.`);
|
||||
return sponsorship;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error updating season sponsorship ${sponsorship.id}:`, error);
|
||||
this.logger.error(`Error updating season sponsorship ${sponsorship.id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -127,7 +127,7 @@ export class InMemorySeasonSponsorshipRepository implements ISeasonSponsorshipRe
|
||||
this.logger.warn(`SeasonSponsorship with id ${id} not found for deletion.`);
|
||||
}
|
||||
} catch (error) {
|
||||
this.logger.error(`Error deleting season sponsorship ${id}:`, error);
|
||||
this.logger.error(`Error deleting season sponsorship ${id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -139,7 +139,7 @@ export class InMemorySeasonSponsorshipRepository implements ISeasonSponsorshipRe
|
||||
this.logger.debug(`SeasonSponsorship ${id} exists: ${exists}.`);
|
||||
return exists;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error checking existence of season sponsorship with id ${id}:`, error);
|
||||
this.logger.error(`Error checking existence of season sponsorship with id ${id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -156,7 +156,7 @@ export class InMemorySeasonSponsorshipRepository implements ISeasonSponsorshipRe
|
||||
}
|
||||
this.logger.info(`Successfully seeded ${sponsorships.length} season sponsorships.`);
|
||||
} catch (error) {
|
||||
this.logger.error(`Error seeding season sponsorships:`, error);
|
||||
this.logger.error(`Error seeding season sponsorships:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ export class InMemorySessionRepository implements ISessionRepository {
|
||||
}
|
||||
return session;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding session by id ${id}:`, error);
|
||||
this.logger.error(`Error finding session by id ${id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -41,7 +41,7 @@ export class InMemorySessionRepository implements ISessionRepository {
|
||||
this.logger.info(`Found ${sessions.length} sessions.`);
|
||||
return sessions;
|
||||
} catch (error) {
|
||||
this.logger.error('Error finding all sessions:', error);
|
||||
this.logger.error('Error finding all sessions:', error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -55,7 +55,7 @@ export class InMemorySessionRepository implements ISessionRepository {
|
||||
this.logger.info(`Found ${sessions.length} sessions for race event id: ${raceEventId}.`);
|
||||
return sessions;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding sessions by race event id ${raceEventId}:`, error);
|
||||
this.logger.error(`Error finding sessions by race event id ${raceEventId}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -76,7 +76,7 @@ export class InMemorySessionRepository implements ISessionRepository {
|
||||
this.logger.info(`Found ${sessions.length} sessions with status: ${status}.`);
|
||||
return sessions;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding sessions by status ${status}:`, error);
|
||||
this.logger.error(`Error finding sessions by status ${status}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -92,7 +92,7 @@ export class InMemorySessionRepository implements ISessionRepository {
|
||||
this.logger.info(`Session ${session.id} created successfully.`);
|
||||
return session;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error creating session ${session.id}:`, error);
|
||||
this.logger.error(`Error creating session ${session.id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -108,7 +108,7 @@ export class InMemorySessionRepository implements ISessionRepository {
|
||||
this.logger.info(`Session ${session.id} updated successfully.`);
|
||||
return session;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error updating session ${session.id}:`, error);
|
||||
this.logger.error(`Error updating session ${session.id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -122,7 +122,7 @@ export class InMemorySessionRepository implements ISessionRepository {
|
||||
this.logger.warn(`Session with id ${id} not found for deletion.`);
|
||||
}
|
||||
} catch (error) {
|
||||
this.logger.error(`Error deleting session ${id}:`, error);
|
||||
this.logger.error(`Error deleting session ${id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -134,7 +134,7 @@ export class InMemorySessionRepository implements ISessionRepository {
|
||||
this.logger.debug(`Session ${id} exists: ${exists}.`);
|
||||
return exists;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error checking existence of session with id ${id}:`, error);
|
||||
this.logger.error(`Error checking existence of session with id ${id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -153,7 +153,7 @@ export class InMemorySessionRepository implements ISessionRepository {
|
||||
this.logger.info(`Retrieved ${sessions.length} sessions.`);
|
||||
return sessions;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error getting all sessions:`, error);
|
||||
this.logger.error(`Error getting all sessions:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
* InMemory implementation of ISponsorshipPricingRepository
|
||||
*/
|
||||
|
||||
import type { ISponsorshipPricingRepository } from '../../domain/repositories/ISponsorshipPricingRepository';
|
||||
import { SponsorshipPricing } from '../../domain/value-objects/SponsorshipPricing';
|
||||
import type { SponsorableEntityType } from '../../domain/entities/SponsorshipRequest';
|
||||
import type { ISponsorshipPricingRepository } from '@core/racing/domain/repositories/ISponsorshipPricingRepository';
|
||||
import { SponsorshipPricing } from '@core/racing/domain/value-objects/SponsorshipPricing';
|
||||
import type { SponsorableEntityType } from '@core/racing/domain/entities/SponsorshipRequest';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
|
||||
interface StorageKey {
|
||||
@@ -103,7 +103,7 @@ export class InMemorySponsorshipPricingRepository implements ISponsorshipPricing
|
||||
this.logger.info(`Found ${accepting.length} entities accepting applications for type: ${entityType}.`);
|
||||
return accepting;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding accepting applications for entity type ${entityType}:`, error);
|
||||
this.logger.error(`Error finding accepting applications for entity type ${entityType}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -121,7 +121,7 @@ export class InMemorySponsorshipPricingRepository implements ISponsorshipPricing
|
||||
}
|
||||
this.logger.info(`Successfully seeded ${data.length} sponsorship pricing entries.`);
|
||||
} catch (error) {
|
||||
this.logger.error(`Error seeding sponsorship pricing data:`, error);
|
||||
this.logger.error(`Error seeding sponsorship pricing data:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ export class InMemoryStandingRepository implements IStandingRepository {
|
||||
this.logger.info(`Found ${standings.length} standings for league id: ${leagueId}.`);
|
||||
return standings;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding standings for league id ${leagueId}:`, error);
|
||||
this.logger.error(`Error finding standings for league id ${leagueId}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -106,7 +106,7 @@ export class InMemoryStandingRepository implements IStandingRepository {
|
||||
this.logger.info(`Found ${standings.length} standings.`);
|
||||
return standings;
|
||||
} catch (error) {
|
||||
this.logger.error('Error finding all standings:', error);
|
||||
this.logger.error('Error finding all standings:', error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -139,7 +139,7 @@ export class InMemoryStandingRepository implements IStandingRepository {
|
||||
this.logger.info(`${standings.length} standings saved successfully.`);
|
||||
return standings;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error saving many standings:`, error);
|
||||
this.logger.error(`Error saving many standings:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -172,7 +172,7 @@ export class InMemoryStandingRepository implements IStandingRepository {
|
||||
});
|
||||
this.logger.info(`Deleted ${toDelete.length} standings for league id: ${leagueId}.`);
|
||||
} catch (error) {
|
||||
this.logger.error(`Error deleting standings by league id ${leagueId}:`, error);
|
||||
this.logger.error(`Error deleting standings by league id ${leagueId}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -254,7 +254,7 @@ export class InMemoryStandingRepository implements IStandingRepository {
|
||||
}
|
||||
|
||||
// Add points from this result
|
||||
standing = standing.addRaceResult(result.position, pointsSystem);
|
||||
standing = standing.addRaceResult(result.position, resolvedPointsSystem);
|
||||
standingsMap.set(result.driverId, standing);
|
||||
this.logger.debug(`Driver ${result.driverId} in league ${leagueId} accumulated ${standing.points} points.`);
|
||||
});
|
||||
@@ -288,7 +288,7 @@ export class InMemoryStandingRepository implements IStandingRepository {
|
||||
|
||||
return updatedStandings;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error recalculating standings for league ${leagueId}:`, error);
|
||||
this.logger.error(`Error recalculating standings for league ${leagueId}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ async getMembership(teamId: string, driverId: string): Promise<TeamMembership |
|
||||
this.logger.info(`[getActiveMembershipForDriver] Not found - no active membership for driver: ${driverId}.`);
|
||||
return null;
|
||||
} catch (error) {
|
||||
this.logger.error(`[getActiveMembershipForDriver] Error getting active membership for driver ${driverId}:`, error);
|
||||
this.logger.error(`[getActiveMembershipForDriver] Error getting active membership for driver ${driverId}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -110,7 +110,7 @@ async getMembership(teamId: string, driverId: string): Promise<TeamMembership |
|
||||
this.logger.info(`[getTeamMembers] Success - found ${members.length} members for team: ${teamId}.`);
|
||||
return members;
|
||||
} catch (error) {
|
||||
this.logger.error(`[getTeamMembers] Error getting team members for team ${teamId}:`, error);
|
||||
this.logger.error(`[getTeamMembers] Error getting team members for team ${teamId}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -123,7 +123,7 @@ async getMembership(teamId: string, driverId: string): Promise<TeamMembership |
|
||||
this.logger.info(`[countByTeamId] Success - counted ${count} active members for team: ${teamId}.`);
|
||||
return count;
|
||||
} catch (error) {
|
||||
this.logger.error(`[countByTeamId] Error counting members for team ${teamId}:`, error);
|
||||
this.logger.error(`[countByTeamId] Error counting members for team ${teamId}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -181,7 +181,7 @@ async getMembership(teamId: string, driverId: string): Promise<TeamMembership |
|
||||
this.logger.info(`[getJoinRequests] Success - found ${requests.length} join requests for team: ${teamId}.`);
|
||||
return requests;
|
||||
} catch (error) {
|
||||
this.logger.error(`[getJoinRequests] Error getting join requests for team ${teamId}:`, error);
|
||||
this.logger.error(`[getJoinRequests] Error getting join requests for team ${teamId}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -203,7 +203,7 @@ async getMembership(teamId: string, driverId: string): Promise<TeamMembership |
|
||||
this.joinRequestsByTeam.set(request.teamId, list);
|
||||
return request;
|
||||
} catch (error) {
|
||||
this.logger.error(`[saveJoinRequest] Error saving join request ${request.id}:`, error);
|
||||
this.logger.error(`[saveJoinRequest] Error saving join request ${request.id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -226,7 +226,7 @@ async getMembership(teamId: string, driverId: string): Promise<TeamMembership |
|
||||
this.logger.warn(`[removeJoinRequest] Not found - join request with ID ${requestId} not found for removal.`);
|
||||
}
|
||||
} catch (error) {
|
||||
this.logger.error(`[removeJoinRequest] Error removing join request ${requestId}:`, error);
|
||||
this.logger.error(`[removeJoinRequest] Error removing join request ${requestId}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ export class InMemoryTeamRepository implements ITeamRepository {
|
||||
}
|
||||
return team;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding team by id ${id}:`, error);
|
||||
this.logger.error(`Error finding team by id ${id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -49,7 +49,7 @@ export class InMemoryTeamRepository implements ITeamRepository {
|
||||
this.logger.info(`Found ${teams.length} teams.`);
|
||||
return teams;
|
||||
} catch (error) {
|
||||
this.logger.error('Error finding all teams:', error);
|
||||
this.logger.error('Error finding all teams:', error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -63,7 +63,7 @@ export class InMemoryTeamRepository implements ITeamRepository {
|
||||
this.logger.info(`Found ${teams.length} teams for league id: ${leagueId}.`);
|
||||
return teams;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding teams by league id ${leagueId}:`, error);
|
||||
this.logger.error(`Error finding teams by league id ${leagueId}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -80,7 +80,7 @@ export class InMemoryTeamRepository implements ITeamRepository {
|
||||
this.logger.info(`Team ${team.id} created successfully.`);
|
||||
return team;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error creating team ${team.id}:`, error);
|
||||
this.logger.error(`Error creating team ${team.id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -97,7 +97,7 @@ export class InMemoryTeamRepository implements ITeamRepository {
|
||||
this.logger.info(`Team ${team.id} updated successfully.`);
|
||||
return team;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error updating team ${team.id}:`, error);
|
||||
this.logger.error(`Error updating team ${team.id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -113,7 +113,7 @@ export class InMemoryTeamRepository implements ITeamRepository {
|
||||
this.teams.delete(id);
|
||||
this.logger.info(`Team ${id} deleted successfully.`);
|
||||
} catch (error) {
|
||||
this.logger.error(`Error deleting team ${id}:`, error);
|
||||
this.logger.error(`Error deleting team ${id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -125,7 +125,7 @@ export class InMemoryTeamRepository implements ITeamRepository {
|
||||
this.logger.debug(`Team ${id} exists: ${exists}.`);
|
||||
return exists;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error checking existence of team with id ${id}:`, error);
|
||||
this.logger.error(`Error checking existence of team with id ${id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ export class InMemoryTrackRepository implements ITrackRepository {
|
||||
}
|
||||
return track;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding track by id ${id}:`, error);
|
||||
this.logger.error(`Error finding track by id ${id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -50,7 +50,7 @@ export class InMemoryTrackRepository implements ITrackRepository {
|
||||
this.logger.info(`Found ${tracks.length} tracks.`);
|
||||
return tracks;
|
||||
} catch (error) {
|
||||
this.logger.error('Error finding all tracks:', error);
|
||||
this.logger.error('Error finding all tracks:', error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -64,7 +64,7 @@ export class InMemoryTrackRepository implements ITrackRepository {
|
||||
this.logger.info(`Found ${tracks.length} tracks for game id: ${gameId}.`);
|
||||
return tracks;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding tracks by game id ${gameId}:`, error);
|
||||
this.logger.error(`Error finding tracks by game id ${gameId}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -78,7 +78,7 @@ export class InMemoryTrackRepository implements ITrackRepository {
|
||||
this.logger.info(`Found ${tracks.length} tracks for category: ${category}.`);
|
||||
return tracks;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding tracks by category ${category}:`, error);
|
||||
this.logger.error(`Error finding tracks by category ${category}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -92,7 +92,7 @@ export class InMemoryTrackRepository implements ITrackRepository {
|
||||
this.logger.info(`Found ${tracks.length} tracks for country: ${country}.`);
|
||||
return tracks;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding tracks by country ${country}:`, error);
|
||||
this.logger.error(`Error finding tracks by country ${country}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -110,7 +110,7 @@ export class InMemoryTrackRepository implements ITrackRepository {
|
||||
this.logger.info(`Found ${tracks.length} tracks matching search query: ${query}.`);
|
||||
return tracks;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error searching tracks by name query ${query}:`, error);
|
||||
this.logger.error(`Error searching tracks by name query ${query}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -127,7 +127,7 @@ export class InMemoryTrackRepository implements ITrackRepository {
|
||||
this.logger.info(`Track ${track.id} created successfully.`);
|
||||
return track;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error creating track ${track.id}:`, error);
|
||||
this.logger.error(`Error creating track ${track.id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -144,7 +144,7 @@ export class InMemoryTrackRepository implements ITrackRepository {
|
||||
this.logger.info(`Track ${track.id} updated successfully.`);
|
||||
return track;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error updating track ${track.id}:`, error);
|
||||
this.logger.error(`Error updating track ${track.id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -160,7 +160,7 @@ export class InMemoryTrackRepository implements ITrackRepository {
|
||||
this.tracks.delete(id);
|
||||
this.logger.info(`Track ${id} deleted successfully.`);
|
||||
} catch (error) {
|
||||
this.logger.error(`Error deleting track ${id}:`, error);
|
||||
this.logger.error(`Error deleting track ${id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -172,7 +172,7 @@ export class InMemoryTrackRepository implements ITrackRepository {
|
||||
this.logger.debug(`Track ${id} exists: ${exists}.`);
|
||||
return exists;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error checking existence of track with id ${id}:`, error);
|
||||
this.logger.error(`Error checking existence of track with id ${id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ export class InMemoryTransactionRepository implements ITransactionRepository {
|
||||
}
|
||||
return transaction;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding transaction by id ${id}:`, error);
|
||||
this.logger.error(`Error finding transaction by id ${id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -44,7 +44,7 @@ export class InMemoryTransactionRepository implements ITransactionRepository {
|
||||
this.logger.info(`Found ${transactions.length} transactions for wallet id: ${walletId}.`);
|
||||
return transactions;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding transactions by wallet id ${walletId}:`, error);
|
||||
this.logger.error(`Error finding transactions by wallet id ${walletId}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -56,7 +56,7 @@ export class InMemoryTransactionRepository implements ITransactionRepository {
|
||||
this.logger.info(`Found ${transactions.length} transactions of type: ${type}.`);
|
||||
return transactions;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error finding transactions by type ${type}:`, error);
|
||||
this.logger.error(`Error finding transactions by type ${type}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -72,7 +72,7 @@ export class InMemoryTransactionRepository implements ITransactionRepository {
|
||||
this.logger.info(`Transaction ${transaction.id} created successfully.`);
|
||||
return transaction;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error creating transaction ${transaction.id}:`, error);
|
||||
this.logger.error(`Error creating transaction ${transaction.id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -88,7 +88,7 @@ export class InMemoryTransactionRepository implements ITransactionRepository {
|
||||
this.logger.info(`Transaction ${transaction.id} updated successfully.`);
|
||||
return transaction;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error updating transaction ${transaction.id}:`, error);
|
||||
this.logger.error(`Error updating transaction ${transaction.id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -102,7 +102,7 @@ export class InMemoryTransactionRepository implements ITransactionRepository {
|
||||
this.logger.warn(`Transaction with id ${id} not found for deletion.`);
|
||||
}
|
||||
} catch (error) {
|
||||
this.logger.error(`Error deleting transaction ${id}:`, error);
|
||||
this.logger.error(`Error deleting transaction ${id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
@@ -114,7 +114,7 @@ export class InMemoryTransactionRepository implements ITransactionRepository {
|
||||
this.logger.debug(`Transaction ${id} exists: ${exists}.`);
|
||||
return exists;
|
||||
} catch (error) {
|
||||
this.logger.error(`Error checking existence of transaction with id ${id}:`, error);
|
||||
this.logger.error(`Error checking existence of transaction with id ${id}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Global, Module } from '@nestjs/common';
|
||||
import { Logger } from '@core/shared/application/Logger';
|
||||
import { ConsoleLogger } from '@core//logging/ConsoleLogger';
|
||||
import { ConsoleLogger } from '@adapters/logging/ConsoleLogger';
|
||||
|
||||
@Global()
|
||||
@Module({
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Controller, Post, Body, Res, HttpStatus } from '@nestjs/common';
|
||||
import { Response } from 'express';
|
||||
import { RecordPageViewInput, RecordPageViewOutput, RecordEngagementInput, RecordEngagementOutput } from './dto/AnalyticsDto';
|
||||
import type { Response } from 'express';
|
||||
import type { RecordPageViewInput, RecordPageViewOutput, RecordEngagementInput, RecordEngagementOutput } from './dto/AnalyticsDto';
|
||||
import { AnalyticsService } from './AnalyticsService';
|
||||
|
||||
@Controller('analytics')
|
||||
|
||||
@@ -9,13 +9,13 @@ const IENGAGEMENT_REPO_TOKEN = 'IEngagementRepository_TOKEN';
|
||||
const RECORD_PAGE_VIEW_USE_CASE_TOKEN = 'RecordPageViewUseCase_TOKEN';
|
||||
const RECORD_ENGAGEMENT_USE_CASE_TOKEN = 'RecordEngagementUseCase_TOKEN';
|
||||
|
||||
import { Logger } from '@core/shared/application';
|
||||
import { IPageViewRepository } from '@core/analytics/application/repositories/IPageViewRepository';
|
||||
import { IEngagementRepository } from '@core/analytics/domain/repositories/IEngagementRepository';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import type { IPageViewRepository } from '@core/analytics/application/repositories/IPageViewRepository';
|
||||
import type { IEngagementRepository } from '@core/analytics/domain/repositories/IEngagementRepository';
|
||||
|
||||
import { ConsoleLogger } from '../../../..//logging/ConsoleLogger';
|
||||
import { InMemoryPageViewRepository } from '../../../..//analytics/persistence/inmemory/InMemoryPageViewRepository';
|
||||
import { InMemoryEngagementRepository } from '../../../..//analytics/persistence/inmemory/InMemoryEngagementRepository';
|
||||
import { ConsoleLogger } from '@adapters/logging/ConsoleLogger';
|
||||
import { InMemoryPageViewRepository } from '@adapters/analytics/persistence/inmemory/InMemoryPageViewRepository';
|
||||
import { InMemoryEngagementRepository } from '@adapters/analytics/persistence/inmemory/InMemoryEngagementRepository';
|
||||
|
||||
export const AnalyticsProviders: Provider[] = [
|
||||
AnalyticsService,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Injectable, Inject } from '@nestjs/common';
|
||||
import { RecordEngagementInput, RecordEngagementOutput, RecordPageViewInput, RecordPageViewOutput } from './dto/AnalyticsDto';
|
||||
import { Logger } from '@core/shared/application';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import { RecordPageViewUseCase } from './use-cases/RecordPageViewUseCase';
|
||||
import { RecordEngagementUseCase } from './use-cases/RecordEngagementUseCase';
|
||||
|
||||
|
||||
@@ -20,11 +20,11 @@ export enum VisitorType {
|
||||
export class RecordPageViewInput {
|
||||
@ApiProperty({ enum: EntityType })
|
||||
@IsEnum(EntityType)
|
||||
entityType: EntityType;
|
||||
entityType!: EntityType;
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
entityId: string;
|
||||
entityId!: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@IsOptional()
|
||||
@@ -33,11 +33,11 @@ export class RecordPageViewInput {
|
||||
|
||||
@ApiProperty({ enum: VisitorType })
|
||||
@IsEnum(VisitorType)
|
||||
visitorType: VisitorType;
|
||||
visitorType!: VisitorType;
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
sessionId: string;
|
||||
sessionId!: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@IsOptional()
|
||||
@@ -58,7 +58,7 @@ export class RecordPageViewInput {
|
||||
export class RecordPageViewOutput {
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
pageViewId: string;
|
||||
pageViewId!: string;
|
||||
}
|
||||
|
||||
// From core/analytics/domain/types/EngagementEvent.ts
|
||||
@@ -87,15 +87,15 @@ export enum EngagementEntityType {
|
||||
export class RecordEngagementInput {
|
||||
@ApiProperty({ enum: EngagementAction })
|
||||
@IsEnum(EngagementAction)
|
||||
action: EngagementAction;
|
||||
action!: EngagementAction;
|
||||
|
||||
@ApiProperty({ enum: EngagementEntityType })
|
||||
@IsEnum(EngagementEntityType)
|
||||
entityType: EngagementEntityType;
|
||||
entityType!: EngagementEntityType;
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
entityId: string;
|
||||
entityId!: string;
|
||||
|
||||
@ApiProperty({ required: false })
|
||||
@IsOptional()
|
||||
@@ -104,13 +104,13 @@ export class RecordEngagementInput {
|
||||
|
||||
@ApiProperty({ enum: ['anonymous', 'driver', 'sponsor'] })
|
||||
@IsEnum(['anonymous', 'driver', 'sponsor'])
|
||||
actorType: 'anonymous' | 'driver' | 'sponsor';
|
||||
actorType!: 'anonymous' | 'driver' | 'sponsor';
|
||||
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
sessionId: string;
|
||||
sessionId!: string;
|
||||
|
||||
@ApiProperty({ required: false, type: 'object'/*, additionalProperties: { type: 'string' || 'number' || 'boolean' }*/ })
|
||||
@ApiProperty({ required: false, type: Object })
|
||||
@IsOptional()
|
||||
@IsObject()
|
||||
metadata?: Record<string, string | number | boolean>;
|
||||
@@ -119,9 +119,9 @@ export class RecordEngagementInput {
|
||||
export class RecordEngagementOutput {
|
||||
@ApiProperty()
|
||||
@IsString()
|
||||
eventId: string;
|
||||
eventId!: string;
|
||||
|
||||
@ApiProperty()
|
||||
@IsNumber()
|
||||
engagementWeight: number;
|
||||
engagementWeight!: number;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { RecordEngagementUseCase } from './RecordEngagementUseCase';
|
||||
import { IEngagementRepository } from '@core/analytics/domain/repositories/IEngagementRepository';
|
||||
import { Logger } from '@core/shared/application';
|
||||
import type { IEngagementRepository } from '@core/analytics/domain/repositories/IEngagementRepository';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
|
||||
describe('RecordEngagementUseCase', () => {
|
||||
let useCase: RecordEngagementUseCase;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Injectable, Inject } from '@nestjs/common';
|
||||
import { RecordEngagementInput, RecordEngagementOutput } from '../dto/AnalyticsDto';
|
||||
import { IEngagementRepository } from '@core/analytics/domain/repositories/IEngagementRepository';
|
||||
import { Logger } from '@core/shared/application';
|
||||
import type { IEngagementRepository } from '@core/analytics/domain/repositories/IEngagementRepository';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import { EngagementEvent } from '@core/analytics/domain/entities/EngagementEvent';
|
||||
|
||||
const Logger_TOKEN = 'Logger_TOKEN';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { RecordPageViewUseCase } from './RecordPageViewUseCase';
|
||||
import { IPageViewRepository } from '@core/analytics/application/repositories/IPageViewRepository';
|
||||
import { Logger } from '@core/shared/application';
|
||||
import type { IPageViewRepository } from '@core/analytics/application/repositories/IPageViewRepository';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
|
||||
describe('RecordPageViewUseCase', () => {
|
||||
let useCase: RecordPageViewUseCase;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Injectable, Inject } from '@nestjs/common';
|
||||
import { RecordPageViewInput, RecordPageViewOutput } from '../dto/AnalyticsDto';
|
||||
import { IPageViewRepository } from '@core/analytics/application/repositories/IPageViewRepository';
|
||||
import { Logger } from '@core/shared/application';
|
||||
import type { IPageViewRepository } from '@core/analytics/application/repositories/IPageViewRepository';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import { PageView } from '@core/analytics/domain/entities/PageView';
|
||||
|
||||
const Logger_TOKEN = 'Logger_TOKEN';
|
||||
|
||||
@@ -2,17 +2,17 @@ import { Provider } from '@nestjs/common';
|
||||
import { AuthService } from './AuthService';
|
||||
|
||||
// Import interfaces and concrete implementations
|
||||
import { IAuthRepository } from '@core/identity/domain/repositories/IAuthRepository';
|
||||
import type { IAuthRepository } from '@core/identity/domain/repositories/IAuthRepository';
|
||||
import { IUserRepository, StoredUser } from '@core/identity/domain/repositories/IUserRepository';
|
||||
import { IPasswordHashingService } from '@core/identity/domain/services/PasswordHashingService';
|
||||
import { Logger } from '@core/shared/application';
|
||||
import type { IPasswordHashingService } from '@core/identity/domain/services/PasswordHashingService';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
|
||||
import { InMemoryAuthRepository } from '../../..//identity/persistence/inmemory/InMemoryAuthRepository';
|
||||
import { InMemoryUserRepository } from '../../..//identity/persistence/inmemory/InMemoryUserRepository';
|
||||
import { InMemoryPasswordHashingService } from '../../..//identity/services/InMemoryPasswordHashingService';
|
||||
import { ConsoleLogger } from '../../..//logging/ConsoleLogger';
|
||||
import { IdentitySessionPort } from '@core/identity/application/ports/IdentitySessionPort'; // Path from apps/api/src/modules/auth
|
||||
import { CookieIdentitySessionAdapter } from '../../..//identity/session/CookieIdentitySessionAdapter';
|
||||
import { InMemoryAuthRepository } from '@adapters/identity/persistence/inmemory/InMemoryAuthRepository';
|
||||
import { InMemoryUserRepository } from '@adapters/identity/persistence/inmemory/InMemoryUserRepository';
|
||||
import { InMemoryPasswordHashingService } from '@adapters/identity/services/InMemoryPasswordHashingService';
|
||||
import { ConsoleLogger } from '@adapters/logging/ConsoleLogger';
|
||||
import { IdentitySessionPort } from '@core/identity/application/ports/IdentitySessionPort';
|
||||
import { CookieIdentitySessionAdapter } from '@adapters/identity/session/CookieIdentitySessionAdapter';
|
||||
|
||||
// Define the tokens for dependency injection
|
||||
export const AUTH_REPOSITORY_TOKEN = 'IAuthRepository';
|
||||
|
||||
@@ -11,13 +11,13 @@ import { LoginWithIracingCallbackUseCase } from '@core/identity/application/use-
|
||||
|
||||
// Core Interfaces and Tokens
|
||||
import { AUTH_REPOSITORY_TOKEN, PASSWORD_HASHING_SERVICE_TOKEN, LOGGER_TOKEN, IDENTITY_SESSION_PORT_TOKEN, USER_REPOSITORY_TOKEN } from './AuthProviders';
|
||||
import { IAuthRepository } from '@core/identity/domain/repositories/IAuthRepository';
|
||||
import { IPasswordHashingService } from '@core/identity/domain/services/PasswordHashingService';
|
||||
import { Logger } from "@gridpilot/core/shared/application";
|
||||
import type { IAuthRepository } from '@core/identity/domain/repositories/IAuthRepository';
|
||||
import type { IPasswordHashingService } from '@core/identity/domain/services/PasswordHashingService';
|
||||
import type { Logger } from "@core/shared/application";
|
||||
import { IdentitySessionPort } from '@core/identity/application/ports/IdentitySessionPort';
|
||||
import { UserId } from '@core/identity/domain/value-objects/UserId';
|
||||
import { User } from '@core/identity/domain/entities/User';
|
||||
import { IUserRepository } from '@core/identity/domain/repositories/IUserRepository';
|
||||
import type { IUserRepository } from '@core/identity/domain/repositories/IUserRepository';
|
||||
import { AuthenticatedUserDTO as CoreAuthenticatedUserDTO } from '@core/identity/application/dto/AuthenticatedUserDTO';
|
||||
|
||||
@Injectable()
|
||||
@@ -47,8 +47,8 @@ export class AuthService {
|
||||
private mapUserToAuthenticatedUserDTO(user: User): AuthenticatedUserDTO {
|
||||
return {
|
||||
userId: user.getId().value,
|
||||
email: user.getEmail(),
|
||||
displayName: user.getDisplayName(),
|
||||
email: user.getEmail() ?? '',
|
||||
displayName: user.getDisplayName() ?? '',
|
||||
// Map other fields as necessary
|
||||
iracingCustomerId: user.getIracingCustomerId() ?? undefined,
|
||||
primaryDriverId: user.getPrimaryDriverId() ?? undefined,
|
||||
@@ -106,7 +106,7 @@ export class AuthService {
|
||||
user: authenticatedUserDTO,
|
||||
};
|
||||
} catch (error) {
|
||||
this.logger.error(`[AuthService] Login failed for email ${params.email}:`, error);
|
||||
this.logger.error(`[AuthService] Login failed for email ${params.email}:`, error instanceof Error ? error : new Error(String(error)));
|
||||
throw new InternalServerErrorException('Login failed due to invalid credentials or server error.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,27 +2,27 @@ import { ApiProperty } from '@nestjs/swagger';
|
||||
|
||||
export class AuthenticatedUserDTO {
|
||||
@ApiProperty()
|
||||
userId: string;
|
||||
userId!: string;
|
||||
@ApiProperty()
|
||||
email: string;
|
||||
email!: string;
|
||||
@ApiProperty()
|
||||
displayName: string;
|
||||
displayName!: string;
|
||||
}
|
||||
|
||||
export class AuthSessionDTO {
|
||||
@ApiProperty()
|
||||
token: string;
|
||||
token!: string;
|
||||
@ApiProperty()
|
||||
user: AuthenticatedUserDTO;
|
||||
user!: AuthenticatedUserDTO;
|
||||
}
|
||||
|
||||
export class SignupParams {
|
||||
@ApiProperty()
|
||||
email: string;
|
||||
email!: string;
|
||||
@ApiProperty()
|
||||
password: string;
|
||||
password!: string;
|
||||
@ApiProperty()
|
||||
displayName: string;
|
||||
displayName!: string;
|
||||
@ApiProperty({ required: false })
|
||||
iracingCustomerId?: string;
|
||||
@ApiProperty({ required: false })
|
||||
@@ -33,23 +33,23 @@ export class SignupParams {
|
||||
|
||||
export class LoginParams {
|
||||
@ApiProperty()
|
||||
email: string;
|
||||
email!: string;
|
||||
@ApiProperty()
|
||||
password: string;
|
||||
password!: string;
|
||||
}
|
||||
|
||||
export class IracingAuthRedirectResult {
|
||||
@ApiProperty()
|
||||
redirectUrl: string;
|
||||
redirectUrl!: string;
|
||||
@ApiProperty()
|
||||
state: string;
|
||||
state!: string;
|
||||
}
|
||||
|
||||
export class LoginWithIracingCallbackParams {
|
||||
@ApiProperty()
|
||||
code: string;
|
||||
code!: string;
|
||||
@ApiProperty()
|
||||
state: string;
|
||||
state!: string;
|
||||
@ApiProperty({ required: false })
|
||||
returnTo?: string;
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import { DriverRatingProvider } from '@core/racing/application/ports/DriverRatin
|
||||
import { IImageServicePort } from '@core/racing/application/ports/IImageServicePort';
|
||||
import { IRaceRegistrationRepository } from '@core/racing/domain/repositories/IRaceRegistrationRepository';
|
||||
import { INotificationPreferenceRepository } from '@core/notifications/domain/repositories/INotificationPreferenceRepository';
|
||||
import { Logger } from "@gridpilot/core/shared/application";
|
||||
import type { Logger } from "@gridpilot/core/shared/application";
|
||||
|
||||
// Import use cases
|
||||
import { GetDriversLeaderboardUseCase } from '@core/racing/application/use-cases/GetDriversLeaderboardUseCase';
|
||||
|
||||
@@ -4,7 +4,7 @@ import { GetDriversLeaderboardUseCase } from '@core/racing/application/use-cases
|
||||
import { GetTotalDriversUseCase } from '@core/racing/application/use-cases/GetTotalDriversUseCase';
|
||||
import { CompleteDriverOnboardingUseCase } from '@core/racing/application/use-cases/CompleteDriverOnboardingUseCase';
|
||||
import { IsDriverRegisteredForRaceUseCase } from '@core/racing/application/use-cases/IsDriverRegisteredForRaceUseCase';
|
||||
import { Logger } from '@core/shared/application';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
|
||||
describe('DriverService', () => {
|
||||
let service: DriverService;
|
||||
|
||||
@@ -15,7 +15,7 @@ import { DriverRegistrationStatusPresenter } from './presenters/DriverRegistrati
|
||||
|
||||
// Tokens
|
||||
import { GET_DRIVERS_LEADERBOARD_USE_CASE_TOKEN, GET_TOTAL_DRIVERS_USE_CASE_TOKEN, COMPLETE_DRIVER_ONBOARDING_USE_CASE_TOKEN, IS_DRIVER_REGISTERED_FOR_RACE_USE_CASE_TOKEN, LOGGER_TOKEN } from './DriverProviders';
|
||||
import { Logger } from '@core/shared/application';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
|
||||
@Injectable()
|
||||
export class DriverService {
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Provider } from '@nestjs/common';
|
||||
import { LeagueService } from './LeagueService';
|
||||
|
||||
// Import core interfaces
|
||||
import { Logger } from '@core/shared/application/Logger';
|
||||
import type { Logger } from '@core/shared/application/Logger';
|
||||
|
||||
// Import concrete in-memory implementations
|
||||
import { InMemoryLeagueRepository } from '@adapters/racing/persistence/inmemory/InMemoryLeagueRepository';
|
||||
|
||||
@@ -13,7 +13,7 @@ import { RemoveLeagueMemberUseCase } from '@core/racing/application/use-cases/Re
|
||||
import { UpdateLeagueMemberRoleUseCase } from '@core/racing/application/use-cases/UpdateLeagueMemberRoleUseCase';
|
||||
import { GetLeagueOwnerSummaryUseCase } from '@core/racing/application/use-cases/GetLeagueOwnerSummaryUseCase';
|
||||
import { GetLeagueProtestsUseCase } from '@core/racing/application/use-cases/GetLeagueProtestsUseCase';
|
||||
import { Logger } from '@core/shared/application/Logger';
|
||||
import type { Logger } from '@core/shared/application/Logger';
|
||||
|
||||
describe('LeagueService', () => {
|
||||
let service: LeagueService;
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Injectable, Inject } from '@nestjs/common';
|
||||
import { AllLeaguesWithCapacityViewModel, LeagueStatsDto, LeagueJoinRequestViewModel, ApproveJoinRequestInput, ApproveJoinRequestOutput, RejectJoinRequestInput, RejectJoinRequestOutput, LeagueAdminPermissionsViewModel, RemoveLeagueMemberInput, RemoveLeagueMemberOutput, UpdateLeagueMemberRoleInput, UpdateLeagueMemberRoleOutput, LeagueOwnerSummaryViewModel, LeagueConfigFormModelDto, LeagueAdminProtestsViewModel, LeagueSeasonSummaryViewModel, GetLeagueAdminPermissionsInput, GetLeagueProtestsQuery, GetLeagueSeasonsQuery, GetLeagueAdminConfigQuery, GetLeagueOwnerSummaryQuery, LeagueMembershipsViewModel, LeagueStandingsViewModel, LeagueScheduleViewModel, LeagueStatsViewModel, LeagueAdminViewModel, CreateLeagueInput, CreateLeagueOutput } from './dto/LeagueDto';
|
||||
|
||||
// Core imports
|
||||
import { Logger } from '@core/shared/application/Logger';
|
||||
import type { Logger } from '@core/shared/application/Logger';
|
||||
|
||||
// Use cases
|
||||
import { GetAllLeaguesWithCapacityUseCase } from '@core/racing/application/use-cases/GetAllLeaguesWithCapacityUseCase';
|
||||
@@ -144,7 +144,7 @@ export class LeagueService {
|
||||
await this.getLeagueFullConfigUseCase.execute({ leagueId: query.leagueId }, presenter);
|
||||
return presenter.viewModel;
|
||||
} catch (error) {
|
||||
this.logger.error('Error getting league full config', error);
|
||||
this.logger.error('Error getting league full config', error instanceof Error ? error : new Error(String(error)));
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import { MediaService } from './MediaService';
|
||||
import { IAvatarGenerationRepository } from '@core/media/domain/repositories/IAvatarGenerationRepository';
|
||||
import { FaceValidationPort } from '@core/media/application/ports/FaceValidationPort';
|
||||
import { AvatarGenerationPort } from '@core/media/application/ports/AvatarGenerationPort';
|
||||
import { Logger } from '@core/shared/application';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
|
||||
// Import use cases
|
||||
import { RequestAvatarGenerationUseCase } from '@core/media/application/use-cases/RequestAvatarGenerationUseCase';
|
||||
|
||||
@@ -9,7 +9,7 @@ import { RequestAvatarGenerationPresenter } from './presenters/RequestAvatarGene
|
||||
|
||||
// Tokens
|
||||
import { REQUEST_AVATAR_GENERATION_USE_CASE_TOKEN, LOGGER_TOKEN } from './MediaProviders';
|
||||
import { Logger } from '@core/shared/application';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
|
||||
@Injectable()
|
||||
export class MediaService {
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Provider } from '@nestjs/common';
|
||||
import { RaceService } from './RaceService';
|
||||
|
||||
// Import core interfaces
|
||||
import { Logger } from '@core/shared/application/Logger';
|
||||
import type { Logger } from '@core/shared/application/Logger';
|
||||
import { IRaceRepository } from '@core/racing/domain/repositories/IRaceRepository';
|
||||
import { ILeagueRepository } from '@core/racing/domain/repositories/ILeagueRepository';
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Injectable, Inject } from '@nestjs/common';
|
||||
import { AllRacesPageViewModel, RaceStatsDto, ImportRaceResultsInput, ImportRaceResultsSummaryViewModel } from './dto/RaceDto';
|
||||
|
||||
// Core imports
|
||||
import { Logger } from '@core/shared/application/Logger';
|
||||
import type { Logger } from '@core/shared/application/Logger';
|
||||
|
||||
// Use cases
|
||||
import { GetAllRacesUseCase } from '@core/racing/application/use-cases/GetAllRacesUseCase';
|
||||
|
||||
@@ -10,7 +10,7 @@ import { ILeagueMembershipRepository } from '@core/racing/domain/repositories/IL
|
||||
import { IRaceRepository } from '@core/racing/domain/repositories/IRaceRepository';
|
||||
import { ISponsorshipPricingRepository } from '@core/racing/domain/repositories/ISponsorshipPricingRepository';
|
||||
import { ISponsorshipRequestRepository } from '@core/racing/domain/repositories/ISponsorshipRequestRepository';
|
||||
import { Logger } from '@core/shared/application';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
|
||||
// Import use cases
|
||||
import { GetSponsorshipPricingUseCase } from '@core/racing/application/use-cases/GetSponsorshipPricingUseCase';
|
||||
|
||||
@@ -17,7 +17,7 @@ import { GetSponsorSponsorshipsPresenter } from './presenters/GetSponsorSponsors
|
||||
|
||||
// Tokens
|
||||
import { GET_SPONSORSHIP_PRICING_USE_CASE_TOKEN, GET_SPONSORS_USE_CASE_TOKEN, CREATE_SPONSOR_USE_CASE_TOKEN, GET_SPONSOR_DASHBOARD_USE_CASE_TOKEN, GET_SPONSOR_SPONSORSHIPS_USE_CASE_TOKEN, LOGGER_TOKEN } from './SponsorProviders';
|
||||
import { Logger } from '@core/shared/application';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
|
||||
@Injectable()
|
||||
export class SponsorService {
|
||||
|
||||
@@ -6,7 +6,7 @@ import { ITeamRepository } from '@core/racing/domain/repositories/ITeamRepositor
|
||||
import { ITeamMembershipRepository } from '@core/racing/domain/repositories/ITeamMembershipRepository';
|
||||
import { IDriverRepository } from '@core/racing/domain/repositories/IDriverRepository';
|
||||
import { IImageServicePort } from '@core/racing/application/ports/IImageServicePort';
|
||||
import { Logger } from '@core/shared/application/Logger';
|
||||
import type { Logger } from '@core/shared/application/Logger';
|
||||
|
||||
// Import concrete in-memory implementations
|
||||
import { InMemoryTeamRepository } from '@adapters/racing/persistence/inmemory/InMemoryTeamRepository';
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { TeamService } from './TeamService';
|
||||
import { GetAllTeamsUseCase } from '@core/racing/application/use-cases/GetAllTeamsUseCase';
|
||||
import { GetDriverTeamUseCase } from '@core/racing/application/use-cases/GetDriverTeamUseCase';
|
||||
import { Logger } from '@core/shared/application/Logger';
|
||||
import type { Logger } from '@core/shared/application/Logger';
|
||||
import { AllTeamsPresenter } from './presenters/AllTeamsPresenter';
|
||||
import { DriverTeamPresenter } from './presenters/DriverTeamPresenter';
|
||||
import { AllTeamsViewModel, DriverTeamViewModel, GetDriverTeamQuery } from './dto/TeamDto';
|
||||
|
||||
@@ -20,7 +20,7 @@ import { TeamMembersPresenter } from './presenters/TeamMembersPresenter';
|
||||
import { TeamJoinRequestsPresenter } from './presenters/TeamJoinRequestsPresenter';
|
||||
|
||||
// Logger
|
||||
import { Logger } from '@core/shared/application/Logger';
|
||||
import type { Logger } from '@core/shared/application/Logger';
|
||||
|
||||
// Tokens
|
||||
import {
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
|
||||
import type { AsyncUseCase } from '@core/shared/application';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import type { IPageViewRepository } from '../../domain/repositories/IPageViewRepository';
|
||||
import type { IEngagementRepository } from '../../domain/repositories/IEngagementRepository';
|
||||
import type { IAnalyticsSnapshotRepository } from '../../domain/repositories/IAnalyticsSnapshotRepository';
|
||||
import type { IPageViewRepository } from '../repositories/IPageViewRepository';
|
||||
import type { IEngagementRepository } from '@core/analytics/domain/repositories/IEngagementRepository';
|
||||
import type { IAnalyticsSnapshotRepository } from '@core/analytics/domain/repositories/IAnalyticsSnapshotRepository';
|
||||
import type { EntityType } from '../../domain/types/PageView';
|
||||
import type { SnapshotPeriod } from '../../domain/types/AnalyticsSnapshot';
|
||||
|
||||
@@ -69,7 +69,8 @@ export class GetEntityAnalyticsQuery
|
||||
);
|
||||
this.logger.debug(`Total page views for entity ${input.entityId}: ${totalPageViews}`);
|
||||
} catch (error) {
|
||||
this.logger.error(`Error counting total page views for entity ${input.entityId}: ${error.message}`);
|
||||
const err = error instanceof Error ? error : new Error(String(error));
|
||||
this.logger.error(`Error counting total page views for entity ${input.entityId}: ${err.message}`);
|
||||
throw error;
|
||||
}
|
||||
|
||||
@@ -82,7 +83,8 @@ export class GetEntityAnalyticsQuery
|
||||
);
|
||||
this.logger.debug(`Unique visitors for entity ${input.entityId}: ${uniqueVisitors}`);
|
||||
} catch (error) {
|
||||
this.logger.error(`Error counting unique visitors for entity ${input.entityId}: ${error.message}`);
|
||||
const err = error instanceof Error ? error : new Error(String(error));
|
||||
this.logger.error(`Error counting unique visitors for entity ${input.entityId}: ${err.message}`);
|
||||
throw error;
|
||||
}
|
||||
|
||||
@@ -94,7 +96,8 @@ export class GetEntityAnalyticsQuery
|
||||
);
|
||||
this.logger.debug(`Sponsor clicks for entity ${input.entityId}: ${sponsorClicks}`);
|
||||
} catch (error) {
|
||||
this.logger.error(`Error getting sponsor clicks for entity ${input.entityId}: ${error.message}`);
|
||||
const err = error instanceof Error ? error : new Error(String(error));
|
||||
this.logger.error(`Error getting sponsor clicks for entity ${input.entityId}: ${err.message}`);
|
||||
throw error;
|
||||
}
|
||||
|
||||
@@ -104,7 +107,8 @@ export class GetEntityAnalyticsQuery
|
||||
engagementScore = await this.calculateEngagementScore(input.entityId, since);
|
||||
this.logger.debug(`Engagement score for entity ${input.entityId}: ${engagementScore}`);
|
||||
} catch (error) {
|
||||
this.logger.error(`Error calculating engagement score for entity ${input.entityId}: ${error.message}`);
|
||||
const err = error instanceof Error ? error : new Error(String(error));
|
||||
this.logger.error(`Error calculating engagement score for entity ${input.entityId}: ${err.message}`);
|
||||
throw error;
|
||||
}
|
||||
|
||||
@@ -130,7 +134,8 @@ export class GetEntityAnalyticsQuery
|
||||
previousPageViews = fullPreviousPageViews - totalPageViews; // This calculates change, not just previous period's total
|
||||
this.logger.debug(`Previous period full page views: ${fullPreviousPageViews}, change: ${previousPageViews}`);
|
||||
} catch (error) {
|
||||
this.logger.error(`Error counting previous period page views for entity ${input.entityId}: ${error.message}`);
|
||||
const err = error instanceof Error ? error : new Error(String(error));
|
||||
this.logger.error(`Error counting previous period page views for entity ${input.entityId}: ${err.message}`);
|
||||
throw error;
|
||||
}
|
||||
|
||||
@@ -145,7 +150,8 @@ export class GetEntityAnalyticsQuery
|
||||
this.logger.debug(`Previous period full unique visitors: ${fullPreviousUniqueVisitors}, change: ${previousUniqueVisitors}`);
|
||||
|
||||
} catch (error) {
|
||||
this.logger.error(`Error counting previous period unique visitors for entity ${input.entityId}: ${error.message}`);
|
||||
const err = error instanceof Error ? error : new Error(String(error));
|
||||
this.logger.error(`Error counting previous period unique visitors for entity ${input.entityId}: ${err.message}`);
|
||||
throw error;
|
||||
}
|
||||
|
||||
@@ -218,7 +224,8 @@ export class GetEntityAnalyticsQuery
|
||||
sponsorClicks = await this.engagementRepository.getSponsorClicksForEntity(entityId, since);
|
||||
this.logger.debug(`Sponsor clicks for engagement score for entity ${entityId}: ${sponsorClicks}`);
|
||||
} catch (error) {
|
||||
this.logger.error(`Error getting sponsor clicks for engagement score for entity ${entityId}: ${error.message}`);
|
||||
const err = error instanceof Error ? error : new Error(String(error));
|
||||
this.logger.error(`Error getting sponsor clicks for engagement score for entity ${entityId}: ${err.message}`);
|
||||
throw error;
|
||||
}
|
||||
const score = sponsorClicks * 10; // Weighted score
|
||||
|
||||
@@ -8,7 +8,7 @@ import type { AsyncUseCase } from '@core/shared/application';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import { PageView } from '../../domain/entities/PageView';
|
||||
import type { EntityType, VisitorType } from '../../domain/types/PageView';
|
||||
import type { IPageViewRepository } from '../../domain/repositories/IPageViewRepository';
|
||||
import type { IPageViewRepository } from '../repositories/IPageViewRepository';
|
||||
|
||||
export interface RecordPageViewInput {
|
||||
entityType: EntityType;
|
||||
@@ -57,7 +57,8 @@ export class RecordPageViewUseCase
|
||||
this.logger.info('Page view recorded successfully', { pageViewId, input });
|
||||
return { pageViewId };
|
||||
} catch (error) {
|
||||
this.logger.error('Error recording page view', error, { input });
|
||||
const err = error instanceof Error ? error : new Error(String(error));
|
||||
this.logger.error('Error recording page view', err, { input });
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
export interface Logger {
|
||||
debug(message: string, ...args: any[]): void;
|
||||
info(message: string, ...args: any[]): void;
|
||||
warn(message: string, ...args: any[]): void;
|
||||
error(message: string, ...args: any[]): void;
|
||||
debug(message: string, ...args: unknown[]): void;
|
||||
info(message: string, ...args: unknown[]): void;
|
||||
warn(message: string, ...args: unknown[]): void;
|
||||
error(message: string, ...args: unknown[]): void;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { AnalyticsEntityId } from '../../../core/analytics/domain/value-objects/AnalyticsEntityId';
|
||||
import { AnalyticsEntityId } from '@core/analytics/domain/value-objects/AnalyticsEntityId';
|
||||
|
||||
describe('AnalyticsEntityId', () => {
|
||||
it('creates a valid AnalyticsEntityId from a non-empty string', () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { AnalyticsSessionId } from '../../../core/analytics/domain/value-objects/AnalyticsSessionId';
|
||||
import { AnalyticsSessionId } from '@core/analytics/domain/value-objects/AnalyticsSessionId';
|
||||
|
||||
describe('AnalyticsSessionId', () => {
|
||||
it('creates a valid AnalyticsSessionId from a non-empty string', () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { PageViewId } from '../../../core/analytics/domain/value-objects/PageViewId';
|
||||
import { PageViewId } from '@core/analytics/domain/value-objects/PageViewId';
|
||||
|
||||
describe('PageViewId', () => {
|
||||
it('creates a valid PageViewId from a non-empty string', () => {
|
||||
|
||||
@@ -10,8 +10,8 @@ export * from './domain/entities/PageView';
|
||||
export * from './domain/entities/EngagementEvent';
|
||||
export * from './domain/entities/AnalyticsSnapshot';
|
||||
|
||||
// Domain repositories
|
||||
export * from './domain/repositories/IPageViewRepository';
|
||||
// Application repositories
|
||||
export * from './application/repositories/IPageViewRepository';
|
||||
export * from './domain/repositories/IEngagementRepository';
|
||||
export * from './domain/repositories/IAnalyticsSnapshotRepository';
|
||||
|
||||
@@ -20,7 +20,7 @@ export * from './application/use-cases/RecordPageViewUseCase';
|
||||
export * from './application/use-cases/RecordEngagementUseCase';
|
||||
export * from './application/use-cases/GetEntityAnalyticsQuery';
|
||||
|
||||
// Infrastructure
|
||||
export * from './infrastructure/repositories/InMemoryPageViewRepository';
|
||||
export * from './infrastructure/repositories/InMemoryEngagementRepository';
|
||||
export * from './infrastructure/repositories/InMemoryAnalyticsSnapshotRepository';
|
||||
// Infrastructure (moved to adapters)
|
||||
export type { IPageViewRepository } from './application/repositories/IPageViewRepository';
|
||||
export type { IEngagementRepository } from './domain/repositories/IEngagementRepository';
|
||||
export type { IAnalyticsSnapshotRepository } from './domain/repositories/IAnalyticsSnapshotRepository';
|
||||
@@ -5,7 +5,7 @@ import { CompleteOnboardingPresenter } from '@apps/api/src/modules/driver/presen
|
||||
|
||||
describe('CompleteDriverOnboardingUseCase', () => {
|
||||
let useCase: CompleteDriverOnboardingUseCase;
|
||||
let driverRepository: { findById: any; save: any };
|
||||
let driverRepository: { findById: () => Promise<any>; save: () => Promise<void> };
|
||||
|
||||
beforeEach(() => {
|
||||
driverRepository = {
|
||||
|
||||
@@ -5,7 +5,7 @@ import type { CheckoutServicePort } from '@core/automation/application/ports/Che
|
||||
import type { CheckoutConfirmationPort } from '@core/automation/application/ports/CheckoutConfirmationPort';
|
||||
import type { CheckoutInfoDTO } from '@core/automation/application/dto/CheckoutInfoDTO';
|
||||
import { CheckoutPrice } from '@core/automation/domain/value-objects/CheckoutPrice';
|
||||
import { CheckoutState, CheckoutStateEnum } from '@core/automation/domain/value-objects/CheckoutState';
|
||||
|
||||
import { CheckoutConfirmation } from '@core/automation/domain/value-objects/CheckoutConfirmation';
|
||||
|
||||
/**
|
||||
|
||||
@@ -35,7 +35,7 @@ describe('ICheckoutConfirmationPort contract', () => {
|
||||
it('should define the required interface structure', () => {
|
||||
// This test verifies the port interface contract exists
|
||||
const mockPort: ICheckoutConfirmationPort = {
|
||||
requestCheckoutConfirmation: async (_request: CheckoutConfirmationRequest) => {
|
||||
requestCheckoutConfirmation: async (__request: CheckoutConfirmationRequest) => {
|
||||
return Result.ok(CheckoutConfirmation.create('confirmed'));
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { describe, expect, test } from 'vitest'
|
||||
import { OverlayAction, ActionAck } from '@core/automation/application/ports/IOverlaySyncPort'
|
||||
import { IAutomationEventPublisher, AutomationEvent } from '@core/automation/application/ports/IAutomationEventPublisher'
|
||||
import { OverlayAction } from '@core/automation/application/ports/IOverlaySyncPort'
|
||||
import { IAutomationLifecycleEmitter, LifecycleCallback } from '@core/automation/infrastructure//IAutomationLifecycleEmitter'
|
||||
import { OverlaySyncService } from '@core/automation/application/services/OverlaySyncService'
|
||||
|
||||
@@ -26,7 +25,7 @@ describe('OverlaySyncService (unit)', () => {
|
||||
// create service wiring: pass emitter as dependency (constructor shape expected)
|
||||
const svc = new OverlaySyncService({
|
||||
lifecycleEmitter: emitter,
|
||||
logger: console as any,
|
||||
logger: console as unknown,
|
||||
publisher: { publish: async () => {} },
|
||||
})
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ describe('OverlaySyncService timeout (unit)', () => {
|
||||
const emitter = new MockLifecycleEmitter()
|
||||
const svc = new OverlaySyncService({
|
||||
lifecycleEmitter: emitter,
|
||||
logger: console as any,
|
||||
logger: console as unknown,
|
||||
publisher: { publish: async () => {} },
|
||||
})
|
||||
|
||||
|
||||
@@ -469,7 +469,7 @@ describe('RecalculateChampionshipStandingsUseCase', () => {
|
||||
|
||||
races.forEach((race) => raceRepository.seedRace(race));
|
||||
|
||||
const drivers = ['driver-1', 'driver-2', 'driver-3'];
|
||||
const _drivers = ['driver-1', 'driver-2', 'driver-3'];
|
||||
|
||||
const resultsData: Array<{
|
||||
raceId: string;
|
||||
|
||||
@@ -73,7 +73,7 @@ describe('StartAutomationSessionUseCase', () => {
|
||||
expect(mockSessionRepository.save).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
config,
|
||||
currentStep: expect.objectContaining({ value: 1 }),
|
||||
_currentStep: expect.objectContaining({ value: 1 }),
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import type { LogLevel } from './LoggerLogLevel';
|
||||
import type { LogContext } from './LoggerContext';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { AutomationSession } from '../../domain/entities/AutomationSession';
|
||||
import { SessionStateValue } from '../../domain/value-objects/SessionState';
|
||||
|
||||
|
||||
export interface SessionRepositoryPort {
|
||||
save(session: AutomationSession): Promise<void>;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { OverlaySyncPort, OverlayAction, ActionAck } from '../ports/OverlaySyncPort';
|
||||
|
||||
import { AutomationEventPublisherPort, AutomationEvent } from '../ports/AutomationEventPublisherPort';
|
||||
import { AutomationLifecycleEmitterPort, LifecycleCallback } from '../ports/AutomationLifecycleEmitterPort';
|
||||
import { LoggerPort } from '../ports/LoggerPort';
|
||||
|
||||
@@ -37,7 +37,7 @@ export class ClearSessionUseCase {
|
||||
});
|
||||
}
|
||||
return result;
|
||||
} catch (error: any) {
|
||||
} catch (error) {
|
||||
this.logger.error('Error clearing user session.', error, {
|
||||
useCase: 'ClearSessionUseCase'
|
||||
});
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Result } from '../../../shared/result/Result';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import type { CheckoutServicePort } from '../ports/CheckoutServicePort';
|
||||
import type { CheckoutConfirmationPort } from '../ports/CheckoutConfirmationPort';
|
||||
import { CheckoutStateEnum } from '../../domain/value-objects/CheckoutState';
|
||||
|
||||
|
||||
interface SessionMetadata {
|
||||
sessionName: string;
|
||||
|
||||
@@ -31,7 +31,7 @@ export class InitiateLoginUseCase {
|
||||
this.logger.warn('Login flow initiation failed.', { error: result.error });
|
||||
}
|
||||
return result;
|
||||
} catch (error: any) {
|
||||
} catch (error) {
|
||||
this.logger.error('Error initiating login flow.', error);
|
||||
return Result.fail(error.message || 'Unknown error during login initiation.');
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { AutomationSession } from '@core/automation/domain/entities/AutomationSession';
|
||||
import { StepId } from '@core/automation/domain/value-objects/StepId';
|
||||
import { SessionState } from '@core/automation/domain/value-objects/SessionState';
|
||||
|
||||
describe('AutomationSession Entity', () => {
|
||||
describe('create', () => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { randomUUID } from 'crypto';
|
||||
import type { IEntity } from '@core/shared/domain';
|
||||
import { StepId } from '../value-objects/StepId';
|
||||
import { SessionState } from '../value-objects/SessionState';
|
||||
|
||||
import type { HostedSessionConfig } from '../types/HostedSessionConfig';
|
||||
import { AutomationDomainError } from '../errors/AutomationDomainError';
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ describe('PageStateValidator', () => {
|
||||
describe('validateState', () => {
|
||||
it('should return valid when all required selectors are present', () => {
|
||||
// Arrange
|
||||
const actualState = (selector: string) => {
|
||||
const actualState = (_selector: string) => {
|
||||
return ['#add-car-button', '#cars-list'].includes(selector);
|
||||
};
|
||||
|
||||
@@ -27,7 +27,7 @@ describe('PageStateValidator', () => {
|
||||
|
||||
it('should return invalid when required selectors are missing', () => {
|
||||
// Arrange
|
||||
const actualState = (selector: string) => {
|
||||
const actualState = (_selector: string) => {
|
||||
return selector === '#add-car-button'; // Only one of two selectors present
|
||||
};
|
||||
|
||||
@@ -48,7 +48,7 @@ describe('PageStateValidator', () => {
|
||||
|
||||
it('should return invalid when forbidden selectors are present', () => {
|
||||
// Arrange
|
||||
const actualState = (selector: string) => {
|
||||
const actualState = (_selector: string) => {
|
||||
return ['#add-car-button', '#set-track'].includes(selector);
|
||||
};
|
||||
|
||||
@@ -70,7 +70,7 @@ describe('PageStateValidator', () => {
|
||||
|
||||
it('should handle empty forbidden selectors array', () => {
|
||||
// Arrange
|
||||
const actualState = (selector: string) => {
|
||||
const actualState = (_selector: string) => {
|
||||
return selector === '#add-car-button';
|
||||
};
|
||||
|
||||
@@ -89,7 +89,7 @@ describe('PageStateValidator', () => {
|
||||
|
||||
it('should handle undefined forbidden selectors', () => {
|
||||
// Arrange
|
||||
const actualState = (selector: string) => {
|
||||
const actualState = (_selector: string) => {
|
||||
return selector === '#add-car-button';
|
||||
};
|
||||
|
||||
@@ -108,7 +108,7 @@ describe('PageStateValidator', () => {
|
||||
|
||||
it('should return error result when actualState function throws', () => {
|
||||
// Arrange
|
||||
const actualState = (selector: string) => {
|
||||
const actualState = (_selector: string) => {
|
||||
throw new Error('Selector evaluation failed');
|
||||
};
|
||||
|
||||
@@ -144,7 +144,7 @@ describe('PageStateValidator', () => {
|
||||
|
||||
it('should validate complex state with both required and forbidden selectors', () => {
|
||||
// Arrange - Simulate being on Cars page but Track page elements leaked through
|
||||
const actualState = (selector: string) => {
|
||||
const actualState = (_selector: string) => {
|
||||
const presentSelectors = ['#add-car-button', '#cars-list', '#set-track'];
|
||||
return presentSelectors.includes(selector);
|
||||
};
|
||||
|
||||
@@ -26,7 +26,7 @@ export interface PageStateValidationResult {
|
||||
}
|
||||
|
||||
export interface PageStateValidationInput {
|
||||
actualState: (selector: string) => boolean;
|
||||
actualState: (_selector: string) => boolean;
|
||||
validation: PageStateValidation;
|
||||
realMode?: boolean;
|
||||
}
|
||||
@@ -59,14 +59,14 @@ export class PageStateValidator
|
||||
* @returns Result with validation outcome
|
||||
*/
|
||||
validateState(
|
||||
actualState: (selector: string) => boolean,
|
||||
actualState: (_selector: string) => boolean,
|
||||
validation: PageStateValidation
|
||||
): Result<PageStateValidationResult, Error> {
|
||||
try {
|
||||
const { expectedStep, requiredSelectors, forbiddenSelectors = [] } = validation;
|
||||
|
||||
// Check required selectors are present
|
||||
const missingSelectors = requiredSelectors.filter(selector => !actualState(selector));
|
||||
const missingSelectors = requiredSelectors.filter(_selector => !actualState(_selector));
|
||||
|
||||
if (missingSelectors.length > 0) {
|
||||
const result: PageStateValidationResult = {
|
||||
@@ -79,7 +79,7 @@ export class PageStateValidator
|
||||
}
|
||||
|
||||
// Check forbidden selectors are absent
|
||||
const unexpectedSelectors = forbiddenSelectors.filter(selector => actualState(selector));
|
||||
const unexpectedSelectors = forbiddenSelectors.filter(_selector => actualState(_selector));
|
||||
|
||||
if (unexpectedSelectors.length > 0) {
|
||||
const result: PageStateValidationResult = {
|
||||
@@ -118,7 +118,7 @@ export class PageStateValidator
|
||||
* @returns Result with validation outcome
|
||||
*/
|
||||
validateStateEnhanced(
|
||||
actualState: (selector: string) => boolean,
|
||||
actualState: (_selector: string) => boolean,
|
||||
validation: PageStateValidation,
|
||||
realMode: boolean = false
|
||||
): Result<PageStateValidationResult, Error> {
|
||||
@@ -183,7 +183,7 @@ export class PageStateValidator
|
||||
}
|
||||
|
||||
// Check required selectors are present (with fallbacks for real mode)
|
||||
const missingSelectors = requiredSelectors.filter(selector => {
|
||||
const missingSelectors = requiredSelectors.filter(_selector => {
|
||||
if (realMode) {
|
||||
const relatedSelectors = selectorsToCheck.filter(s =>
|
||||
s.includes(expectedStep) ||
|
||||
@@ -212,7 +212,7 @@ export class PageStateValidator
|
||||
}
|
||||
|
||||
// Check forbidden selectors are absent
|
||||
const unexpectedSelectors = forbiddenSelectors.filter(selector => actualState(selector));
|
||||
const unexpectedSelectors = forbiddenSelectors.filter(_selector => actualState(_selector));
|
||||
|
||||
if (unexpectedSelectors.length > 0) {
|
||||
const result: PageStateValidationResult = {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { StepTransitionValidator } from '@core/automation/domain/services/StepTransitionValidator';
|
||||
import { StepId } from '@core/automation/domain/value-objects/StepId';
|
||||
import { SessionState } from '@core/automation/domain/value-objects/SessionState';
|
||||
|
||||
|
||||
describe('StepTransitionValidator Service', () => {
|
||||
describe('canTransition', () => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { StepId } from '../value-objects/StepId';
|
||||
import { SessionState } from '../value-objects/SessionState';
|
||||
|
||||
import type { IDomainValidationService } from '@core/shared/domain';
|
||||
import { Result } from '../../../shared/result/Result';
|
||||
|
||||
@@ -96,7 +96,7 @@ export class StepTransitionValidator
|
||||
return { isValid: true };
|
||||
}
|
||||
|
||||
static shouldStopAtStep18(nextStep: StepId): boolean {
|
||||
static shouldStopAtStep18(_nextStep: StepId): boolean {
|
||||
return nextStep.isFinalStep();
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ describe('CheckoutConfirmation Value Object', () => {
|
||||
});
|
||||
|
||||
it('should throw error for invalid decision', () => {
|
||||
expect(() => CheckoutConfirmation.create('invalid' as any)).toThrow(
|
||||
expect(() => CheckoutConfirmation.create('invalid' as unknown)).toThrow(
|
||||
'Invalid checkout confirmation decision',
|
||||
);
|
||||
});
|
||||
|
||||
@@ -24,7 +24,7 @@ export class CheckoutConfirmation {
|
||||
return CheckoutConfirmation.create('confirmed');
|
||||
}
|
||||
|
||||
static cancelled(_reason?: string): CheckoutConfirmation {
|
||||
static cancelled(__reason?: string): CheckoutConfirmation {
|
||||
return CheckoutConfirmation.create('cancelled');
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { CheckoutState, CheckoutStateEnum } from '@core/automation/domain/value-objects/CheckoutState';
|
||||
|
||||
|
||||
/**
|
||||
* CheckoutState Value Object - GREEN PHASE
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { SessionState } from '@core/automation/domain/value-objects/SessionState';
|
||||
|
||||
|
||||
describe('SessionState Value Object', () => {
|
||||
describe('create', () => {
|
||||
@@ -44,11 +44,11 @@ describe('SessionState Value Object', () => {
|
||||
});
|
||||
|
||||
it('should throw error for invalid state', () => {
|
||||
expect(() => SessionState.create('INVALID' as any)).toThrow('Invalid session state');
|
||||
expect(() => SessionState.create('INVALID' as unknown)).toThrow('Invalid session state');
|
||||
});
|
||||
|
||||
it('should throw error for empty string', () => {
|
||||
expect(() => SessionState.create('' as any)).toThrow('Invalid session state');
|
||||
expect(() => SessionState.create('' as unknown)).toThrow('Invalid session state');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
|
||||
import { loadAutomationConfig, getAutomationMode, AutomationMode } from '../../../core/automation/infrastructure/config/AutomationConfig';
|
||||
|
||||
|
||||
describe('AutomationConfig', () => {
|
||||
const originalEnv = process.env;
|
||||
@@ -17,7 +17,7 @@ describe('AutomationConfig', () => {
|
||||
describe('getAutomationMode', () => {
|
||||
describe('NODE_ENV-based mode detection', () => {
|
||||
it('should return production mode when NODE_ENV=production', () => {
|
||||
(process.env as any).NODE_ENV = 'production';
|
||||
(process.env as unknown).NODE_ENV = 'production';
|
||||
delete process.env.AUTOMATION_MODE;
|
||||
|
||||
const mode = getAutomationMode();
|
||||
@@ -26,7 +26,7 @@ describe('AutomationConfig', () => {
|
||||
});
|
||||
|
||||
it('should return test mode when NODE_ENV=test', () => {
|
||||
(process.env as any).NODE_ENV = 'test';
|
||||
(process.env as unknown).NODE_ENV = 'test';
|
||||
delete process.env.AUTOMATION_MODE;
|
||||
|
||||
const mode = getAutomationMode();
|
||||
@@ -35,7 +35,7 @@ describe('AutomationConfig', () => {
|
||||
});
|
||||
|
||||
it('should return test mode when NODE_ENV is not set', () => {
|
||||
delete (process.env as any).NODE_ENV;
|
||||
delete (process.env as unknown).NODE_ENV;
|
||||
delete process.env.AUTOMATION_MODE;
|
||||
|
||||
const mode = getAutomationMode();
|
||||
@@ -44,7 +44,7 @@ describe('AutomationConfig', () => {
|
||||
});
|
||||
|
||||
it('should return test mode for unknown NODE_ENV values', () => {
|
||||
(process.env as any).NODE_ENV = 'staging';
|
||||
(process.env as unknown).NODE_ENV = 'staging';
|
||||
delete process.env.AUTOMATION_MODE;
|
||||
|
||||
const mode = getAutomationMode();
|
||||
@@ -53,7 +53,7 @@ describe('AutomationConfig', () => {
|
||||
});
|
||||
|
||||
it('should return development mode when NODE_ENV=development', () => {
|
||||
(process.env as any).NODE_ENV = 'development';
|
||||
(process.env as unknown).NODE_ENV = 'development';
|
||||
delete process.env.AUTOMATION_MODE;
|
||||
|
||||
const mode = getAutomationMode();
|
||||
@@ -104,7 +104,7 @@ describe('AutomationConfig', () => {
|
||||
|
||||
it('should ignore invalid AUTOMATION_MODE and use NODE_ENV', () => {
|
||||
process.env.AUTOMATION_MODE = 'invalid-mode';
|
||||
(process.env as any).NODE_ENV = 'production';
|
||||
(process.env as unknown).NODE_ENV = 'production';
|
||||
|
||||
const mode = getAutomationMode();
|
||||
|
||||
@@ -116,7 +116,7 @@ describe('AutomationConfig', () => {
|
||||
describe('loadAutomationConfig', () => {
|
||||
describe('default configuration', () => {
|
||||
it('should return test mode when NODE_ENV is not set', () => {
|
||||
delete (process.env as any).NODE_ENV;
|
||||
delete (process.env as unknown).NODE_ENV;
|
||||
delete process.env.AUTOMATION_MODE;
|
||||
|
||||
const config = loadAutomationConfig();
|
||||
@@ -143,7 +143,7 @@ describe('AutomationConfig', () => {
|
||||
|
||||
describe('production mode configuration', () => {
|
||||
it('should return production mode when NODE_ENV=production', () => {
|
||||
(process.env as any).NODE_ENV = 'production';
|
||||
(process.env as unknown).NODE_ENV = 'production';
|
||||
delete process.env.AUTOMATION_MODE;
|
||||
|
||||
const config = loadAutomationConfig();
|
||||
@@ -228,7 +228,7 @@ describe('AutomationConfig', () => {
|
||||
});
|
||||
|
||||
it('should fallback to test mode for invalid NODE_ENV', () => {
|
||||
(process.env as any).NODE_ENV = 'invalid-env';
|
||||
(process.env as unknown).NODE_ENV = 'invalid-env';
|
||||
delete process.env.AUTOMATION_MODE;
|
||||
|
||||
const config = loadAutomationConfig();
|
||||
@@ -239,7 +239,7 @@ describe('AutomationConfig', () => {
|
||||
|
||||
describe('full configuration scenario', () => {
|
||||
it('should load complete test environment configuration', () => {
|
||||
(process.env as any).NODE_ENV = 'test';
|
||||
(process.env as unknown).NODE_ENV = 'test';
|
||||
delete process.env.AUTOMATION_MODE;
|
||||
|
||||
const config = loadAutomationConfig();
|
||||
@@ -249,7 +249,7 @@ describe('AutomationConfig', () => {
|
||||
});
|
||||
|
||||
it('should load complete production environment configuration', () => {
|
||||
(process.env as any).NODE_ENV = 'production';
|
||||
(process.env as unknown).NODE_ENV = 'production';
|
||||
delete process.env.AUTOMATION_MODE;
|
||||
|
||||
const config = loadAutomationConfig();
|
||||
|
||||
@@ -12,7 +12,7 @@ describe('BrowserModeConfig - GREEN Phase', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
process.env = { ...originalEnv };
|
||||
delete (process.env as any).NODE_ENV;
|
||||
delete (process.env as unknown).NODE_ENV;
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
@@ -21,7 +21,7 @@ describe('BrowserModeConfig - GREEN Phase', () => {
|
||||
|
||||
describe('Development Mode with Runtime Control', () => {
|
||||
it('should default to headless in development mode', () => {
|
||||
(process.env as any).NODE_ENV = 'development';
|
||||
(process.env as unknown).NODE_ENV = 'development';
|
||||
|
||||
const loader = new BrowserModeConfigLoader();
|
||||
const config = loader.load();
|
||||
@@ -31,7 +31,7 @@ describe('BrowserModeConfig - GREEN Phase', () => {
|
||||
});
|
||||
|
||||
it('should allow runtime switch to headless mode in development', () => {
|
||||
(process.env as any).NODE_ENV = 'development';
|
||||
(process.env as unknown).NODE_ENV = 'development';
|
||||
|
||||
const loader = new BrowserModeConfigLoader();
|
||||
loader.setDevelopmentMode('headless');
|
||||
@@ -42,7 +42,7 @@ describe('BrowserModeConfig - GREEN Phase', () => {
|
||||
});
|
||||
|
||||
it('should allow runtime switch to headed mode in development', () => {
|
||||
(process.env as any).NODE_ENV = 'development';
|
||||
(process.env as unknown).NODE_ENV = 'development';
|
||||
|
||||
const loader = new BrowserModeConfigLoader();
|
||||
loader.setDevelopmentMode('headed');
|
||||
@@ -53,7 +53,7 @@ describe('BrowserModeConfig - GREEN Phase', () => {
|
||||
});
|
||||
|
||||
it('should persist runtime setting across multiple load() calls', () => {
|
||||
(process.env as any).NODE_ENV = 'development';
|
||||
(process.env as unknown).NODE_ENV = 'development';
|
||||
|
||||
const loader = new BrowserModeConfigLoader();
|
||||
loader.setDevelopmentMode('headless');
|
||||
@@ -66,7 +66,7 @@ describe('BrowserModeConfig - GREEN Phase', () => {
|
||||
});
|
||||
|
||||
it('should return current development mode via getter', () => {
|
||||
(process.env as any).NODE_ENV = 'development';
|
||||
(process.env as unknown).NODE_ENV = 'development';
|
||||
|
||||
const loader = new BrowserModeConfigLoader();
|
||||
expect(loader.getDevelopmentMode()).toBe('headless');
|
||||
@@ -78,7 +78,7 @@ describe('BrowserModeConfig - GREEN Phase', () => {
|
||||
|
||||
describe('Production Mode', () => {
|
||||
it('should use headless mode when NODE_ENV=production', () => {
|
||||
(process.env as any).NODE_ENV = 'production';
|
||||
(process.env as unknown).NODE_ENV = 'production';
|
||||
|
||||
const loader = new BrowserModeConfigLoader();
|
||||
const config = loader.load();
|
||||
@@ -88,7 +88,7 @@ describe('BrowserModeConfig - GREEN Phase', () => {
|
||||
});
|
||||
|
||||
it('should ignore setDevelopmentMode in production', () => {
|
||||
(process.env as any).NODE_ENV = 'production';
|
||||
(process.env as unknown).NODE_ENV = 'production';
|
||||
|
||||
const loader = new BrowserModeConfigLoader();
|
||||
loader.setDevelopmentMode('headed');
|
||||
@@ -101,7 +101,7 @@ describe('BrowserModeConfig - GREEN Phase', () => {
|
||||
|
||||
describe('Test Mode', () => {
|
||||
it('should use headless mode when NODE_ENV=test', () => {
|
||||
(process.env as any).NODE_ENV = 'test';
|
||||
(process.env as unknown).NODE_ENV = 'test';
|
||||
|
||||
const loader = new BrowserModeConfigLoader();
|
||||
const config = loader.load();
|
||||
@@ -111,7 +111,7 @@ describe('BrowserModeConfig - GREEN Phase', () => {
|
||||
});
|
||||
|
||||
it('should ignore setDevelopmentMode in test mode', () => {
|
||||
(process.env as any).NODE_ENV = 'test';
|
||||
(process.env as unknown).NODE_ENV = 'test';
|
||||
|
||||
const loader = new BrowserModeConfigLoader();
|
||||
loader.setDevelopmentMode('headed');
|
||||
@@ -124,7 +124,7 @@ describe('BrowserModeConfig - GREEN Phase', () => {
|
||||
|
||||
describe('Default Mode', () => {
|
||||
it('should default to headless mode when NODE_ENV is not set', () => {
|
||||
delete (process.env as any).NODE_ENV;
|
||||
delete (process.env as unknown).NODE_ENV;
|
||||
|
||||
const loader = new BrowserModeConfigLoader();
|
||||
const config = loader.load();
|
||||
@@ -134,7 +134,7 @@ describe('BrowserModeConfig - GREEN Phase', () => {
|
||||
});
|
||||
|
||||
it('should use headless mode for any non-development NODE_ENV value', () => {
|
||||
(process.env as any).NODE_ENV = 'staging';
|
||||
(process.env as unknown).NODE_ENV = 'staging';
|
||||
|
||||
const loader = new BrowserModeConfigLoader();
|
||||
const config = loader.load();
|
||||
@@ -146,7 +146,7 @@ describe('BrowserModeConfig - GREEN Phase', () => {
|
||||
|
||||
describe('Source Tracking', () => {
|
||||
it('should report GUI as source in development mode', () => {
|
||||
(process.env as any).NODE_ENV = 'development';
|
||||
(process.env as unknown).NODE_ENV = 'development';
|
||||
|
||||
const loader = new BrowserModeConfigLoader();
|
||||
const config = loader.load();
|
||||
@@ -155,7 +155,7 @@ describe('BrowserModeConfig - GREEN Phase', () => {
|
||||
});
|
||||
|
||||
it('should report NODE_ENV as source in production mode', () => {
|
||||
(process.env as any).NODE_ENV = 'production';
|
||||
(process.env as unknown).NODE_ENV = 'production';
|
||||
|
||||
const loader = new BrowserModeConfigLoader();
|
||||
const config = loader.load();
|
||||
@@ -164,7 +164,7 @@ describe('BrowserModeConfig - GREEN Phase', () => {
|
||||
});
|
||||
|
||||
it('should report NODE_ENV as source in test mode', () => {
|
||||
(process.env as any).NODE_ENV = 'test';
|
||||
(process.env as unknown).NODE_ENV = 'test';
|
||||
|
||||
const loader = new BrowserModeConfigLoader();
|
||||
const config = loader.load();
|
||||
@@ -173,7 +173,7 @@ describe('BrowserModeConfig - GREEN Phase', () => {
|
||||
});
|
||||
|
||||
it('should report NODE_ENV as source when NODE_ENV is not set', () => {
|
||||
delete (process.env as any).NODE_ENV;
|
||||
delete (process.env as unknown).NODE_ENV;
|
||||
|
||||
const loader = new BrowserModeConfigLoader();
|
||||
const config = loader.load();
|
||||
|
||||
@@ -5,12 +5,12 @@ import type { CheckoutInfoDTO } from '../../../application/dto/CheckoutInfoDTO';
|
||||
import { IRACING_SELECTORS } from './dom/IRacingSelectors';
|
||||
|
||||
interface Page {
|
||||
locator(selector: string): Locator;
|
||||
locator(_selector: string): Locator;
|
||||
}
|
||||
|
||||
interface Locator {
|
||||
first(): Locator;
|
||||
locator(selector: string): Locator;
|
||||
locator(_selector: string): Locator;
|
||||
getAttribute(name: string): Promise<string | null>;
|
||||
innerHTML(): Promise<string>;
|
||||
textContent(): Promise<string | null>;
|
||||
|
||||
@@ -190,7 +190,7 @@ describe('AuthenticationGuard', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('Login button selector specificity', () => {
|
||||
describe('Login button _selector specificity', () => {
|
||||
test('should detect login button on actual login pages', async () => {
|
||||
// Simulate a real login page with a login form
|
||||
const mockLocator = {
|
||||
|
||||
@@ -2,7 +2,7 @@ import { describe, test, expect, beforeEach } from 'vitest';
|
||||
import { SessionCookieStore } from '@core/automation/infrastructure//automation/auth/SessionCookieStore';
|
||||
import type { Cookie } from 'playwright';
|
||||
|
||||
const logger = console as any;
|
||||
const logger = console as unknown;
|
||||
|
||||
describe('SessionCookieStore - Cookie Validation', () => {
|
||||
let cookieStore: SessionCookieStore;
|
||||
|
||||
@@ -20,9 +20,9 @@ import { Result } from '../../../../../shared/result/Result';
|
||||
import { IRACING_SELECTORS, IRACING_URLS, IRACING_TIMEOUTS, ALL_BLOCKED_SELECTORS, BLOCKED_KEYWORDS } from '../dom/IRacingSelectors';
|
||||
import { SessionCookieStore } from '../auth/SessionCookieStore';
|
||||
import { PlaywrightBrowserSession } from './PlaywrightBrowserSession';
|
||||
import { getFixtureForStep } from '../engine/FixtureServer';
|
||||
|
||||
import { BrowserModeConfigLoader, BrowserMode } from '../../../config/BrowserModeConfig';
|
||||
import { getAutomationMode } from '../../../config/AutomationConfig';
|
||||
|
||||
import { PageStateValidator, PageStateValidation, PageStateValidationResult } from '@core/automation/domain/services/PageStateValidator';
|
||||
import { IRacingDomNavigator } from '../dom/IRacingDomNavigator';
|
||||
import { SafeClickService } from '../dom/SafeClickService';
|
||||
@@ -543,7 +543,7 @@ export class PlaywrightAutomationAdapter implements IBrowserAutomation, Authenti
|
||||
*/
|
||||
async attachPanel(page?: Page, actionId?: string): Promise<void> {
|
||||
const selector = '#gridpilot-overlay'
|
||||
await this.emitLifecycle({ type: 'panel-attached', actionId, timestamp: Date.now(), payload: { selector } })
|
||||
await this.emitLifecycle({ type: 'panel-attached', actionId, timestamp: Date.now(), payload: { _selector } })
|
||||
await this.emitLifecycle({ type: 'action-started', actionId, timestamp: Date.now() })
|
||||
}
|
||||
private isRealMode(): boolean {
|
||||
@@ -583,7 +583,7 @@ export class PlaywrightAutomationAdapter implements IBrowserAutomation, Authenti
|
||||
}
|
||||
}
|
||||
|
||||
const actualState = (selector: string): boolean => {
|
||||
const actualState = (_selector: string): boolean => {
|
||||
return selectorChecks[selector] === true;
|
||||
};
|
||||
|
||||
@@ -1247,7 +1247,7 @@ export class PlaywrightAutomationAdapter implements IBrowserAutomation, Authenti
|
||||
* @param elementText Optional text content of the element (should be direct text only)
|
||||
* @returns true if the selector/text matches a blocked pattern
|
||||
*/
|
||||
private isBlockedSelector(selector: string, elementText?: string): boolean {
|
||||
private isBlockedSelector(_selector: string, elementText?: string): boolean {
|
||||
const selectorLower = selector.toLowerCase();
|
||||
const textLower = elementText?.toLowerCase().trim() ?? '';
|
||||
|
||||
@@ -1293,7 +1293,7 @@ export class PlaywrightAutomationAdapter implements IBrowserAutomation, Authenti
|
||||
* @param selector The CSS selector of the element to verify
|
||||
* @throws Error if element is a blocked checkout/payment button
|
||||
*/
|
||||
private async verifyNotBlockedElement(selector: string): Promise<void> {
|
||||
private async verifyNotBlockedElement(_selector: string): Promise<void> {
|
||||
if (!this.page) return;
|
||||
|
||||
// In mock mode we bypass safety blocking to allow tests to exercise checkout flows
|
||||
@@ -1394,7 +1394,7 @@ export class PlaywrightAutomationAdapter implements IBrowserAutomation, Authenti
|
||||
throw error;
|
||||
}
|
||||
// Otherwise ignore - element might not exist yet, safeClick will handle that
|
||||
this.log('debug', 'Could not verify element (may not exist yet)', { selector, error: String(error) });
|
||||
this.log('debug', 'Could not verify element (may not exist yet)', { _selector, error: String(error) });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1409,7 +1409,7 @@ export class PlaywrightAutomationAdapter implements IBrowserAutomation, Authenti
|
||||
* @param options Click options including timeout and force
|
||||
* @returns Promise that resolves when click succeeds or throws after max retries
|
||||
*/
|
||||
private async safeClick(selector: string, options?: { timeout?: number; force?: boolean }): Promise<void> {
|
||||
private async safeClick(_selector: string, options?: { timeout?: number; force?: boolean }): Promise<void> {
|
||||
if (!this.page) {
|
||||
throw new Error('Browser not connected');
|
||||
}
|
||||
@@ -1438,7 +1438,7 @@ export class PlaywrightAutomationAdapter implements IBrowserAutomation, Authenti
|
||||
try {
|
||||
// On final attempt, use force: true if datetime picker issues detected
|
||||
const useForce = options?.force || attempt === maxRetries;
|
||||
await this.page.click(selector, { timeout, force: useForce });
|
||||
await this.page.click(_selector, { timeout, force: useForce });
|
||||
return; // Success
|
||||
} catch (error) {
|
||||
// Re-throw blocked errors immediately
|
||||
@@ -1496,7 +1496,7 @@ export class PlaywrightAutomationAdapter implements IBrowserAutomation, Authenti
|
||||
this.log('debug', 'JS fallback click did not find element or failed', { selector });
|
||||
}
|
||||
} catch (e) {
|
||||
this.log('debug', 'JS fallback click error', { selector, error: String(e) });
|
||||
this.log('debug', 'JS fallback click error', { _selector, error: String(e) });
|
||||
}
|
||||
|
||||
this.log('error', 'Max retries reached, click still blocked', { selector });
|
||||
@@ -1559,7 +1559,7 @@ export class PlaywrightAutomationAdapter implements IBrowserAutomation, Authenti
|
||||
|
||||
if (isVisible) {
|
||||
await radioLabel.click({ timeout: IRACING_TIMEOUTS.elementWait });
|
||||
this.log('info', 'Selected weather type', { weatherType, selector: labelSelector });
|
||||
this.log('info', 'Selected weather type', { weatherType, _selector: labelSelector });
|
||||
} else {
|
||||
this.log('debug', 'Weather type radio not visible, may already be selected or step is different');
|
||||
}
|
||||
@@ -1674,10 +1674,10 @@ export class PlaywrightAutomationAdapter implements IBrowserAutomation, Authenti
|
||||
});
|
||||
// Brief pause for modal animation (reduced from 300ms)
|
||||
await this.page.waitForTimeout(150);
|
||||
this.log('info', 'Add Car modal is visible', { selector: modalSelector });
|
||||
this.log('info', 'Add Car modal is visible', { _selector: modalSelector });
|
||||
} catch (error) {
|
||||
const message = error instanceof Error ? error.message : String(error);
|
||||
this.log('warn', 'Add Car modal not found with primary selector, dumping #create-race-wizard innerHTML and retrying', { error: message });
|
||||
this.log('warn', 'Add Car modal not found with primary _selector, dumping #create-race-wizard innerHTML and retrying', { error: message });
|
||||
const html = await this.page!.innerHTML('#create-race-wizard').catch(() => '');
|
||||
this.log('debug', 'create-race-wizard innerHTML (truncated)', { html: html ? html.slice(0, 2000) : '' });
|
||||
this.log('info', 'Retrying wait for Add Car modal with extended timeout');
|
||||
@@ -1688,7 +1688,7 @@ export class PlaywrightAutomationAdapter implements IBrowserAutomation, Authenti
|
||||
timeout: 10000,
|
||||
});
|
||||
await this.page.waitForTimeout(150);
|
||||
this.log('info', 'Add Car modal found after retry', { selector: modalSelectorRetry });
|
||||
this.log('info', 'Add Car modal found after retry', { _selector: modalSelectorRetry });
|
||||
} catch {
|
||||
this.log('warn', 'Add Car modal still not found after retry');
|
||||
}
|
||||
@@ -1775,7 +1775,7 @@ export class PlaywrightAutomationAdapter implements IBrowserAutomation, Authenti
|
||||
for (const selector of directSelectors) {
|
||||
const button = this.page.locator(selector).first();
|
||||
if (await button.count() > 0 && await button.isVisible()) {
|
||||
await this.safeClick(selector, { timeout: IRACING_TIMEOUTS.elementWait });
|
||||
await this.safeClick(_selector, { timeout: IRACING_TIMEOUTS.elementWait });
|
||||
this.log('info', 'Clicked direct Select button for first search result', { selector });
|
||||
return;
|
||||
}
|
||||
@@ -1788,7 +1788,7 @@ export class PlaywrightAutomationAdapter implements IBrowserAutomation, Authenti
|
||||
if (await dropdownButton.count() > 0 && await dropdownButton.isVisible()) {
|
||||
// Click dropdown to open menu
|
||||
await this.safeClick(dropdownSelector, { timeout: IRACING_TIMEOUTS.elementWait });
|
||||
this.log('debug', 'Clicked dropdown toggle, waiting for menu', { selector: dropdownSelector });
|
||||
this.log('debug', 'Clicked dropdown toggle, waiting for menu', { _selector: dropdownSelector });
|
||||
|
||||
// Wait for dropdown menu to appear
|
||||
await this.page.waitForSelector('.dropdown-menu.show', { timeout: 3000 }).catch(() => { });
|
||||
@@ -1797,7 +1797,7 @@ export class PlaywrightAutomationAdapter implements IBrowserAutomation, Authenti
|
||||
const itemSelector = IRACING_SELECTORS.steps.trackSelectDropdownItem;
|
||||
await this.page.waitForTimeout(200);
|
||||
await this.safeClick(itemSelector, { timeout: IRACING_TIMEOUTS.elementWait });
|
||||
this.log('info', 'Clicked first dropdown item to select track config', { selector: itemSelector });
|
||||
this.log('info', 'Clicked first dropdown item to select track config', { _selector: itemSelector });
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1805,7 +1805,7 @@ export class PlaywrightAutomationAdapter implements IBrowserAutomation, Authenti
|
||||
const carRowSelector = '.car-row, .car-item, [data-testid*="car"], [id*="favorite_cars"], [id*="select-car"]';
|
||||
const carRow = this.page.locator(carRowSelector).first();
|
||||
if (await carRow.count() > 0) {
|
||||
this.log('info', 'Fallback: clicking car row/item to select', { selector: carRowSelector });
|
||||
this.log('info', 'Fallback: clicking car row/item to select', { _selector: carRowSelector });
|
||||
// Click the row itself (or its first clickable descendant)
|
||||
try {
|
||||
await this.safeClick(carRowSelector, { timeout: IRACING_TIMEOUTS.elementWait });
|
||||
@@ -1888,7 +1888,7 @@ export class PlaywrightAutomationAdapter implements IBrowserAutomation, Authenti
|
||||
(await direct.isVisible().catch(() => false));
|
||||
|
||||
if (hasDirect) {
|
||||
this.log('info', 'Clicking direct New Race button', { selector: directSelector });
|
||||
this.log('info', 'Clicking direct New Race button', { _selector: directSelector });
|
||||
await this.safeClick(directSelector, { timeout: IRACING_TIMEOUTS.elementWait });
|
||||
} else {
|
||||
const dropdownToggleSelector =
|
||||
@@ -2100,7 +2100,7 @@ export class PlaywrightAutomationAdapter implements IBrowserAutomation, Authenti
|
||||
}
|
||||
|
||||
try {
|
||||
this.log('debug', `Waiting for wizard step: ${stepName}`, { selector: containerSelector });
|
||||
this.log('debug', `Waiting for wizard step: ${stepName}`, { _selector: containerSelector });
|
||||
// Use 'attached' instead of 'visible' because iRacing wizard steps are marked as
|
||||
// 'active hidden' in the DOM - they exist but are hidden via CSS class
|
||||
await this.page.waitForSelector(containerSelector, {
|
||||
@@ -2129,11 +2129,11 @@ export class PlaywrightAutomationAdapter implements IBrowserAutomation, Authenti
|
||||
const timeout = this.isRealMode() ? IRACING_TIMEOUTS.elementWait : this.config.timeout;
|
||||
|
||||
// Split combined selectors and try each one
|
||||
const selectors = selector.split(', ').map(s => s.trim());
|
||||
const selectors = _selector.split(', ').map(s => s.trim());
|
||||
|
||||
for (const sel of selectors) {
|
||||
try {
|
||||
this.log('debug', `Trying selector for ${fieldName}`, { selector: sel });
|
||||
this.log('debug', `Trying _selector for ${fieldName}`, { _selector: sel });
|
||||
|
||||
// Check if element exists and is visible
|
||||
const element = this.page.locator(sel).first();
|
||||
@@ -2143,11 +2143,11 @@ export class PlaywrightAutomationAdapter implements IBrowserAutomation, Authenti
|
||||
// Use 'attached' instead of 'visible' because iRacing wizard steps have class="hidden"
|
||||
await element.waitFor({ state: 'attached', timeout });
|
||||
await element.fill(value);
|
||||
this.log('info', `Successfully filled ${fieldName}`, { selector: sel, value });
|
||||
this.log('info', `Successfully filled ${fieldName}`, { _selector: sel, value });
|
||||
return { success: true, fieldName, valueSet: value };
|
||||
}
|
||||
} catch (error) {
|
||||
this.log('debug', `Selector failed for ${fieldName}`, { selector: sel, error: String(error) });
|
||||
this.log('debug', `Selector failed for ${fieldName}`, { _selector: sel, error: String(error) });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2155,12 +2155,12 @@ export class PlaywrightAutomationAdapter implements IBrowserAutomation, Authenti
|
||||
try {
|
||||
this.log('debug', `Trying combined selector for ${fieldName}`, { selector });
|
||||
// Use 'attached' instead of 'visible' because iRacing wizard steps have class="hidden"
|
||||
await this.page.waitForSelector(selector, { state: 'attached', timeout });
|
||||
await this.page.waitForSelector(_selector, { state: 'attached', timeout });
|
||||
await this.page.fill(selector, value);
|
||||
return { success: true, fieldName, valueSet: value };
|
||||
} catch (error) {
|
||||
const message = error instanceof Error ? error.message : String(error);
|
||||
this.log('error', `Failed to fill ${fieldName}`, { selector, error: message });
|
||||
this.log('error', `Failed to fill ${fieldName}`, { _selector, error: message });
|
||||
return { success: false, fieldName, valueSet: value, error: message };
|
||||
}
|
||||
}
|
||||
@@ -2194,7 +2194,7 @@ export class PlaywrightAutomationAdapter implements IBrowserAutomation, Authenti
|
||||
// Some wizard footer buttons are present/attached but not considered "visible" by Playwright
|
||||
// (offscreen, overlapped by overlays, or transitional). Use a forced safe click first,
|
||||
// then fall back to name-based or last-resort selectors if that fails.
|
||||
this.log('debug', 'Attempting next button (primary) with forced click', { selector: nextButtonSelector });
|
||||
this.log('debug', 'Attempting next button (primary) with forced click', { _selector: nextButtonSelector });
|
||||
try {
|
||||
await this.safeClick(nextButtonSelector, { timeout, force: true });
|
||||
this.log('info', `Clicked next button to ${nextStepName} (primary forced)`);
|
||||
@@ -2204,7 +2204,7 @@ export class PlaywrightAutomationAdapter implements IBrowserAutomation, Authenti
|
||||
}
|
||||
|
||||
// Try fallback with step name (also attempt forced click)
|
||||
this.log('debug', 'Trying fallback next button (forced)', { selector: fallbackSelector });
|
||||
this.log('debug', 'Trying fallback next button (forced)', { _selector: fallbackSelector });
|
||||
try {
|
||||
await this.safeClick(fallbackSelector, { timeout, force: true });
|
||||
this.log('info', `Clicked next button (fallback) to ${nextStepName}`);
|
||||
@@ -2248,7 +2248,7 @@ export class PlaywrightAutomationAdapter implements IBrowserAutomation, Authenti
|
||||
}
|
||||
|
||||
// Use 'attached' instead of 'visible' because mock fixtures/wizard steps may be present but hidden
|
||||
await this.page.waitForSelector(selector, { state: 'attached', timeout });
|
||||
await this.page.waitForSelector(_selector, { state: 'attached', timeout });
|
||||
await this.safeClick(selector, { timeout });
|
||||
return { success: true, target: selector };
|
||||
}
|
||||
@@ -2260,7 +2260,7 @@ export class PlaywrightAutomationAdapter implements IBrowserAutomation, Authenti
|
||||
const selector = this.getFieldSelector(fieldName);
|
||||
const timeout = this.isRealMode() ? IRACING_TIMEOUTS.elementWait : this.config.timeout;
|
||||
|
||||
this.log('debug', 'fillField', { fieldName, selector, mode: this.config.mode });
|
||||
this.log('debug', 'fillField', { fieldName, _selector, mode: this.config.mode });
|
||||
|
||||
// In mock mode, reveal typical fixture-hidden containers to allow Playwright to interact.
|
||||
if (!this.isRealMode()) {
|
||||
@@ -2277,7 +2277,7 @@ export class PlaywrightAutomationAdapter implements IBrowserAutomation, Authenti
|
||||
}
|
||||
|
||||
// Wait for the element to be attached to the DOM
|
||||
await this.page.waitForSelector(selector, { state: 'attached', timeout });
|
||||
await this.page.waitForSelector(_selector, { state: 'attached', timeout });
|
||||
|
||||
// Try normal Playwright fill first; fall back to JS injection in mock mode if Playwright refuses due to visibility.
|
||||
try {
|
||||
@@ -2315,7 +2315,7 @@ export class PlaywrightAutomationAdapter implements IBrowserAutomation, Authenti
|
||||
|
||||
// Try to wait for the canonical selector first
|
||||
try {
|
||||
await this.page.waitForSelector(selector, { state: 'attached', timeout });
|
||||
await this.page.waitForSelector(_selector, { state: 'attached', timeout });
|
||||
await this.page.selectOption(selector, value);
|
||||
return;
|
||||
} catch {
|
||||
@@ -2774,7 +2774,7 @@ export class PlaywrightAutomationAdapter implements IBrowserAutomation, Authenti
|
||||
// ignore evaluation errors during tests
|
||||
}
|
||||
}
|
||||
await this.page.waitForSelector(selector, { state: 'attached', timeout });
|
||||
await this.page.waitForSelector(_selector, { state: 'attached', timeout });
|
||||
await this.safeClick(selector, { timeout });
|
||||
}
|
||||
|
||||
@@ -2784,7 +2784,7 @@ export class PlaywrightAutomationAdapter implements IBrowserAutomation, Authenti
|
||||
}
|
||||
// Broaden trigger selector to match multiple fixture variants (buttons, anchors, data-action)
|
||||
const escaped = type.replace(/"/g, '\\"');
|
||||
const selector = `button:has-text("${escaped}"), a:has-text("${escaped}"), [aria-label*="${escaped}" i], [data-action="${escaped}"], [data-modal-trigger="${escaped}"]`;
|
||||
const _selector = `button:has-text("${escaped}"), a:has-text("${escaped}"), [aria-label*="${escaped}" i], [data-action="${escaped}"], [data-modal-trigger="${escaped}"]`;
|
||||
const timeout = this.isRealMode() ? IRACING_TIMEOUTS.elementWait : this.config.timeout;
|
||||
|
||||
// In mock mode, reveal typical hidden fixture containers so trigger buttons are discoverable.
|
||||
@@ -2802,7 +2802,7 @@ export class PlaywrightAutomationAdapter implements IBrowserAutomation, Authenti
|
||||
}
|
||||
|
||||
// Use 'attached' instead of 'visible' because iRacing wizard steps have class="hidden"
|
||||
await this.page.waitForSelector(selector, { state: 'attached', timeout });
|
||||
await this.page.waitForSelector(_selector, { state: 'attached', timeout });
|
||||
await this.safeClick(selector, { timeout });
|
||||
}
|
||||
|
||||
@@ -3355,7 +3355,7 @@ export class PlaywrightAutomationAdapter implements IBrowserAutomation, Authenti
|
||||
* @param currentStep Current step number to determine if modal should be visible
|
||||
* @throws Error with 'WIZARD_DISMISSED' message if modal was closed by user
|
||||
*/
|
||||
async checkWizardDismissed(currentStep: number): Promise<void> {
|
||||
async checkWizardDismissed(_currentStep: number): Promise<void> {
|
||||
if (!this.page || !this.isRealMode() || currentStep < 3) {
|
||||
// Don't check before step 3 (modal opens at step 2)
|
||||
return;
|
||||
@@ -3503,7 +3503,7 @@ export class PlaywrightAutomationAdapter implements IBrowserAutomation, Authenti
|
||||
const locator = this.page.locator(sel).first();
|
||||
const count = await locator.count().catch(() => 0);
|
||||
if (count > 0) {
|
||||
this.log('debug', 'Found checkout candidate button selector', { selector: sel });
|
||||
this.log('debug', 'Found checkout candidate button _selector', { _selector: sel });
|
||||
|
||||
// safeClick will no-op in mock mode if element is hidden and will enforce
|
||||
// verifyNotBlockedElement() in real mode to avoid dangerous clicks.
|
||||
|
||||
@@ -6,7 +6,7 @@ import * as path from 'path';
|
||||
|
||||
import type { LoggerPort } from '@core/automation/application/ports/LoggerPort';
|
||||
import { BrowserModeConfigLoader, BrowserMode } from '../../../config/BrowserModeConfig';
|
||||
import { getAutomationMode } from '../../../config/AutomationConfig';
|
||||
|
||||
import type { PlaywrightConfig } from './PlaywrightAutomationAdapter';
|
||||
import { PlaywrightAutomationAdapter } from './PlaywrightAutomationAdapter';
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import { PlaywrightBrowserSession } from './PlaywrightBrowserSession';
|
||||
import { IRacingDomNavigator } from '../dom/IRacingDomNavigator';
|
||||
import { IRacingDomInteractor } from '../dom/IRacingDomInteractor';
|
||||
import { IRACING_SELECTORS } from '../dom/IRacingSelectors';
|
||||
import { getFixtureForStep } from '../engine/FixtureServer';
|
||||
|
||||
import type {
|
||||
PageStateValidation,
|
||||
PageStateValidationResult,
|
||||
@@ -167,7 +167,7 @@ export class WizardStepOrchestrator {
|
||||
await this.navigator.waitForWizardStep(stepName);
|
||||
}
|
||||
|
||||
private async checkWizardDismissed(currentStep: number): Promise<void> {
|
||||
private async checkWizardDismissed(_currentStep: number): Promise<void> {
|
||||
await this.navigator.checkWizardDismissed(currentStep);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import type { PlaywrightConfig } from '../core/PlaywrightAutomationAdapter';
|
||||
import { PlaywrightBrowserSession } from '../core/PlaywrightBrowserSession';
|
||||
import { IRACING_SELECTORS, IRACING_TIMEOUTS } from './IRacingSelectors';
|
||||
import { SafeClickService } from './SafeClickService';
|
||||
import { getFixtureForStep } from '../engine/FixtureServer';
|
||||
|
||||
|
||||
export class IRacingDomInteractor {
|
||||
constructor(
|
||||
@@ -66,10 +66,10 @@ export class IRacingDomInteractor {
|
||||
const selector = fieldMap[fieldName as keyof typeof fieldMap] ?? IRACING_SELECTORS.fields.textInput;
|
||||
const timeout = this.isRealMode() ? IRACING_TIMEOUTS.elementWait : this.config.timeout;
|
||||
|
||||
this.log('debug', 'Filling form field', { fieldName, selector, mode: this.config.mode });
|
||||
this.log('debug', 'Filling form field', { fieldName, _selector, mode: this.config.mode });
|
||||
|
||||
try {
|
||||
await page.waitForSelector(selector, { state: 'attached', timeout });
|
||||
await page.waitForSelector(_selector, { state: 'attached', timeout });
|
||||
|
||||
try {
|
||||
await page.fill(selector, value);
|
||||
@@ -115,8 +115,8 @@ export class IRacingDomInteractor {
|
||||
const selector = this.getActionSelector(target);
|
||||
const timeout = this.isRealMode() ? IRACING_TIMEOUTS.elementWait : this.config.timeout;
|
||||
|
||||
this.log('debug', 'Clicking element', { target, selector, mode: this.config.mode });
|
||||
await page.waitForSelector(selector, { state: 'attached', timeout });
|
||||
this.log('debug', 'Clicking element', { target, _selector, mode: this.config.mode });
|
||||
await page.waitForSelector(_selector, { state: 'attached', timeout });
|
||||
await page.click(selector);
|
||||
return { success: true, target };
|
||||
} catch (error) {
|
||||
@@ -165,7 +165,7 @@ export class IRacingDomInteractor {
|
||||
const selector = this.getFieldSelector(fieldName);
|
||||
const timeout = this.isRealMode() ? IRACING_TIMEOUTS.elementWait : this.config.timeout;
|
||||
|
||||
this.log('debug', 'fillField', { fieldName, selector, mode: this.config.mode });
|
||||
this.log('debug', 'fillField', { fieldName, _selector, mode: this.config.mode });
|
||||
|
||||
if (!this.isRealMode()) {
|
||||
try {
|
||||
@@ -182,7 +182,7 @@ export class IRacingDomInteractor {
|
||||
}
|
||||
}
|
||||
|
||||
await page.waitForSelector(selector, { state: 'attached', timeout });
|
||||
await page.waitForSelector(_selector, { state: 'attached', timeout });
|
||||
|
||||
try {
|
||||
await page.fill(selector, value);
|
||||
@@ -218,11 +218,11 @@ export class IRacingDomInteractor {
|
||||
const selector = this.getFieldSelector(fieldName);
|
||||
const timeout = this.isRealMode() ? IRACING_TIMEOUTS.elementWait : this.config.timeout;
|
||||
|
||||
const selectors = selector.split(', ').map((s) => s.trim());
|
||||
const selectors = _selector.split(', ').map((s) => s.trim());
|
||||
|
||||
for (const sel of selectors) {
|
||||
try {
|
||||
this.log('debug', `Trying selector for ${fieldName}`, { selector: sel });
|
||||
this.log('debug', `Trying _selector for ${fieldName}`, { _selector: sel });
|
||||
|
||||
const element = page.locator(sel).first();
|
||||
const isVisible = await element.isVisible().catch(() => false);
|
||||
@@ -230,22 +230,22 @@ export class IRacingDomInteractor {
|
||||
if (isVisible) {
|
||||
await element.waitFor({ state: 'attached', timeout });
|
||||
await element.fill(value);
|
||||
this.log('info', `Successfully filled ${fieldName}`, { selector: sel, value });
|
||||
this.log('info', `Successfully filled ${fieldName}`, { _selector: sel, value });
|
||||
return { success: true, fieldName, valueSet: value };
|
||||
}
|
||||
} catch (error) {
|
||||
this.log('debug', `Selector failed for ${fieldName}`, { selector: sel, error: String(error) });
|
||||
this.log('debug', `Selector failed for ${fieldName}`, { _selector: sel, error: String(error) });
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
this.log('debug', `Trying combined selector for ${fieldName}`, { selector });
|
||||
await page.waitForSelector(selector, { state: 'attached', timeout });
|
||||
await page.waitForSelector(_selector, { state: 'attached', timeout });
|
||||
await page.fill(selector, value);
|
||||
return { success: true, fieldName, valueSet: value };
|
||||
} catch (error) {
|
||||
const message = error instanceof Error ? error.message : String(error);
|
||||
this.log('error', `Failed to fill ${fieldName}`, { selector, error: message });
|
||||
this.log('error', `Failed to fill ${fieldName}`, { _selector, error: message });
|
||||
return { success: false, fieldName, valueSet: value, error: message };
|
||||
}
|
||||
}
|
||||
@@ -273,7 +273,7 @@ export class IRacingDomInteractor {
|
||||
selector = this.getActionSelector(action);
|
||||
}
|
||||
|
||||
await page.waitForSelector(selector, { state: 'attached', timeout });
|
||||
await page.waitForSelector(_selector, { state: 'attached', timeout });
|
||||
await this.safeClickService.safeClick(selector, { timeout });
|
||||
return { success: true, target: selector };
|
||||
}
|
||||
@@ -316,7 +316,7 @@ export class IRacingDomInteractor {
|
||||
const fallbackSelector = `.wizard-footer a.btn:has-text("${nextStepName}")`;
|
||||
|
||||
try {
|
||||
this.log('debug', 'Attempting next button (primary) with forced click', { selector: nextButtonSelector });
|
||||
this.log('debug', 'Attempting next button (primary) with forced click', { _selector: nextButtonSelector });
|
||||
try {
|
||||
await this.safeClickService.safeClick(nextButtonSelector, { timeout, force: true });
|
||||
this.log('info', `Clicked next button to ${nextStepName} (primary forced)`);
|
||||
@@ -325,7 +325,7 @@ export class IRacingDomInteractor {
|
||||
this.log('debug', 'Primary forced click failed, falling back', { error: String(e) });
|
||||
}
|
||||
|
||||
this.log('debug', 'Trying fallback next button (forced)', { selector: fallbackSelector });
|
||||
this.log('debug', 'Trying fallback next button (forced)', { _selector: fallbackSelector });
|
||||
try {
|
||||
await this.safeClickService.safeClick(fallbackSelector, { timeout, force: true });
|
||||
this.log('info', `Clicked next button (fallback) to ${nextStepName}`);
|
||||
@@ -350,7 +350,7 @@ export class IRacingDomInteractor {
|
||||
const timeout = this.isRealMode() ? IRACING_TIMEOUTS.elementWait : this.config.timeout;
|
||||
|
||||
try {
|
||||
await page.waitForSelector(selector, { state: 'attached', timeout });
|
||||
await page.waitForSelector(_selector, { state: 'attached', timeout });
|
||||
await page.selectOption(selector, value);
|
||||
return;
|
||||
} catch {
|
||||
@@ -754,14 +754,14 @@ export class IRacingDomInteractor {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
await page.waitForSelector(selector, { state: 'attached', timeout });
|
||||
await page.waitForSelector(_selector, { state: 'attached', timeout });
|
||||
await this.safeClickService.safeClick(selector, { timeout });
|
||||
}
|
||||
|
||||
async openModalTrigger(type: string): Promise<void> {
|
||||
const page = this.getPage();
|
||||
const escaped = type.replace(/"/g, '\\"');
|
||||
const selector = `button:has-text("${escaped}"), a:has-text("${escaped}"), [aria-label*="${escaped}" i], [data-action="${escaped}"], [data-modal-trigger="${escaped}"]`;
|
||||
const _selector = `button:has-text("${escaped}"), a:has-text("${escaped}"), [aria-label*="${escaped}" i], [data-action="${escaped}"], [data-modal-trigger="${escaped}"]`;
|
||||
const timeout = this.isRealMode() ? IRACING_TIMEOUTS.elementWait : this.config.timeout;
|
||||
|
||||
if (!this.isRealMode()) {
|
||||
@@ -779,7 +779,7 @@ export class IRacingDomInteractor {
|
||||
}
|
||||
}
|
||||
|
||||
await page.waitForSelector(selector, { state: 'attached', timeout });
|
||||
await page.waitForSelector(_selector, { state: 'attached', timeout });
|
||||
await this.safeClickService.safeClick(selector, { timeout });
|
||||
}
|
||||
|
||||
@@ -816,7 +816,7 @@ export class IRacingDomInteractor {
|
||||
timeout: this.isRealMode() ? IRACING_TIMEOUTS.elementWait : this.config.timeout,
|
||||
});
|
||||
await page.waitForTimeout(150);
|
||||
this.log('info', 'Add Car modal is visible', { selector: modalSelector });
|
||||
this.log('info', 'Add Car modal is visible', { _selector: modalSelector });
|
||||
} catch (error) {
|
||||
const message = error instanceof Error ? error.message : String(error);
|
||||
this.log('warn', 'Add Car modal not found with primary selector, dumping #create-race-wizard innerHTML and retrying', {
|
||||
@@ -832,7 +832,7 @@ export class IRacingDomInteractor {
|
||||
timeout: 10000,
|
||||
});
|
||||
await page.waitForTimeout(150);
|
||||
this.log('info', 'Add Car modal found after retry', { selector: modalSelectorRetry });
|
||||
this.log('info', 'Add Car modal found after retry', { _selector: modalSelectorRetry });
|
||||
} catch {
|
||||
this.log('warn', 'Add Car modal still not found after retry');
|
||||
}
|
||||
@@ -885,7 +885,7 @@ export class IRacingDomInteractor {
|
||||
for (const selector of directSelectors) {
|
||||
const button = page.locator(selector).first();
|
||||
if ((await button.count()) > 0 && (await button.isVisible())) {
|
||||
await this.safeClickService.safeClick(selector, { timeout: IRACING_TIMEOUTS.elementWait });
|
||||
await this.safeClickService.safeClick(_selector, { timeout: IRACING_TIMEOUTS.elementWait });
|
||||
this.log('info', 'Clicked direct Select button for first search result', { selector });
|
||||
return;
|
||||
}
|
||||
@@ -896,14 +896,14 @@ export class IRacingDomInteractor {
|
||||
|
||||
if ((await dropdownButton.count()) > 0 && (await dropdownButton.isVisible())) {
|
||||
await this.safeClickService.safeClick(dropdownSelector, { timeout: IRACING_TIMEOUTS.elementWait });
|
||||
this.log('debug', 'Clicked dropdown toggle, waiting for menu', { selector: dropdownSelector });
|
||||
this.log('debug', 'Clicked dropdown toggle, waiting for menu', { _selector: dropdownSelector });
|
||||
|
||||
await page.waitForSelector('.dropdown-menu.show', { timeout: 3000 }).catch(() => {});
|
||||
|
||||
const itemSelector = IRACING_SELECTORS.steps.trackSelectDropdownItem;
|
||||
await page.waitForTimeout(200);
|
||||
await this.safeClickService.safeClick(itemSelector, { timeout: IRACING_TIMEOUTS.elementWait });
|
||||
this.log('info', 'Clicked first dropdown item to select track config', { selector: itemSelector });
|
||||
this.log('info', 'Clicked first dropdown item to select track config', { _selector: itemSelector });
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -911,7 +911,7 @@ export class IRacingDomInteractor {
|
||||
'.car-row, .car-item, [data-testid*="car"], [id*="favorite_cars"], [id*="select-car"]';
|
||||
const carRow = page.locator(carRowSelector).first();
|
||||
if ((await carRow.count()) > 0) {
|
||||
this.log('info', 'Fallback: clicking car row/item to select', { selector: carRowSelector });
|
||||
this.log('info', 'Fallback: clicking car row/item to select', { _selector: carRowSelector });
|
||||
try {
|
||||
await this.safeClickService.safeClick(carRowSelector, { timeout: IRACING_TIMEOUTS.elementWait });
|
||||
this.log('info', 'Clicked car row fallback selector');
|
||||
@@ -1078,7 +1078,7 @@ export class IRacingDomInteractor {
|
||||
|
||||
if (isVisible) {
|
||||
await radioLabel.click({ timeout: IRACING_TIMEOUTS.elementWait });
|
||||
this.log('info', 'Selected weather type', { weatherType, selector: labelSelector });
|
||||
this.log('info', 'Selected weather type', { weatherType, _selector: labelSelector });
|
||||
} else {
|
||||
this.log('debug', 'Weather type radio not visible, may already be selected or step is different');
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ export class IRacingDomNavigator {
|
||||
selector = IRACING_SELECTORS.wizard.modal;
|
||||
}
|
||||
|
||||
this.log('debug', 'Waiting for element', { target, selector, mode: this.config.mode });
|
||||
this.log('debug', 'Waiting for element', { target, _selector, mode: this.config.mode });
|
||||
await page.waitForSelector(selector, {
|
||||
state: 'attached',
|
||||
timeout: maxWaitMs ?? defaultTimeout,
|
||||
@@ -164,7 +164,7 @@ export class IRacingDomNavigator {
|
||||
}
|
||||
|
||||
try {
|
||||
this.log('debug', `Waiting for wizard step: ${stepName}`, { selector: containerSelector });
|
||||
this.log('debug', `Waiting for wizard step: ${stepName}`, { _selector: containerSelector });
|
||||
await page.waitForSelector(containerSelector, {
|
||||
state: 'attached',
|
||||
timeout: 15000,
|
||||
@@ -297,7 +297,7 @@ export class IRacingDomNavigator {
|
||||
}
|
||||
}
|
||||
|
||||
async checkWizardDismissed(currentStep: number): Promise<void> {
|
||||
async checkWizardDismissed(_currentStep: number): Promise<void> {
|
||||
if (!this.isRealMode() || currentStep < 3) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ export class SafeClickService {
|
||||
* @param elementText Optional text content of the element (should be direct text only)
|
||||
* @returns true if the selector/text matches a blocked pattern
|
||||
*/
|
||||
private isBlockedSelector(selector: string, elementText?: string): boolean {
|
||||
private isBlockedSelector(_selector: string, elementText?: string): boolean {
|
||||
const selectorLower = selector.toLowerCase();
|
||||
const textLower = elementText?.toLowerCase().trim() ?? '';
|
||||
|
||||
@@ -88,7 +88,7 @@ export class SafeClickService {
|
||||
* @param selector The CSS selector of the element to verify
|
||||
* @throws Error if element is a blocked checkout/payment button
|
||||
*/
|
||||
async verifyNotBlockedElement(selector: string): Promise<void> {
|
||||
async verifyNotBlockedElement(_selector: string): Promise<void> {
|
||||
const page = this.browserSession.getPage();
|
||||
if (!page) return;
|
||||
|
||||
@@ -191,7 +191,7 @@ export class SafeClickService {
|
||||
if (error instanceof Error && error.message.includes('BLOCKED')) {
|
||||
throw error;
|
||||
}
|
||||
this.log('debug', 'Could not verify element (may not exist yet)', { selector, error: String(error) });
|
||||
this.log('debug', 'Could not verify element (may not exist yet)', { _selector, error: String(error) });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -368,7 +368,7 @@ export class SafeClickService {
|
||||
for (let attempt = 1; attempt <= maxRetries; attempt++) {
|
||||
try {
|
||||
const useForce = options?.force || attempt === maxRetries;
|
||||
await page.click(selector, { timeout, force: useForce });
|
||||
await page.click(_selector, { timeout, force: useForce });
|
||||
return;
|
||||
} catch (error) {
|
||||
if (error instanceof Error && error.message.includes('BLOCKED')) {
|
||||
@@ -418,7 +418,7 @@ export class SafeClickService {
|
||||
this.log('debug', 'JS fallback click did not find element or failed', { selector });
|
||||
}
|
||||
} catch (e) {
|
||||
this.log('debug', 'JS fallback click error', { selector, error: String(e) });
|
||||
this.log('debug', 'JS fallback click error', { _selector, error: String(e) });
|
||||
}
|
||||
|
||||
this.log('error', 'Max retries reached, click still blocked', { selector });
|
||||
|
||||
@@ -70,7 +70,7 @@ export class MockBrowserAutomationAdapter implements IBrowserAutomation, IAutoma
|
||||
};
|
||||
}
|
||||
|
||||
async clickElement(selector: string): Promise<ClickResultDTO> {
|
||||
async clickElement(_selector: string): Promise<ClickResultDTO> {
|
||||
const delay = this.randomDelay(50, 300);
|
||||
await this.sleep(delay);
|
||||
return {
|
||||
@@ -79,7 +79,7 @@ export class MockBrowserAutomationAdapter implements IBrowserAutomation, IAutoma
|
||||
};
|
||||
}
|
||||
|
||||
async waitForElement(selector: string, maxWaitMs: number = 5000): Promise<WaitResultDTO> {
|
||||
async waitForElement(_selector: string, maxWaitMs: number = 5000): Promise<WaitResultDTO> {
|
||||
const delay = this.randomDelay(100, 1000);
|
||||
|
||||
await this.sleep(delay);
|
||||
|
||||
@@ -3,17 +3,17 @@ import type { LogContext } from '../../../application/ports/LoggerContext';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
|
||||
export class NoOpLogAdapter implements LoggerPort, Logger {
|
||||
debug(_message: string, _context?: LogContext): void {}
|
||||
debug(__message: string, __context?: LogContext): void {}
|
||||
|
||||
info(_message: string, _context?: LogContext): void {}
|
||||
info(__message: string, __context?: LogContext): void {}
|
||||
|
||||
warn(_message: string, _context?: LogContext): void {}
|
||||
warn(__message: string, __context?: LogContext): void {}
|
||||
|
||||
error(_message: string, _error?: Error, _context?: LogContext): void {}
|
||||
error(__message: string, __error?: Error, __context?: LogContext): void {}
|
||||
|
||||
fatal(_message: string, _error?: Error, _context?: LogContext): void {}
|
||||
fatal(__message: string, __error?: Error, __context?: LogContext): void {}
|
||||
|
||||
child(_context: LogContext): LoggerPort {
|
||||
child(__context: LogContext): LoggerPort {
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { AutomationSession } from '../../domain/entities/AutomationSession';
|
||||
import { SessionStateValue } from '../../domain/value-objects/SessionState';
|
||||
|
||||
import type { SessionRepositoryPort } from '../../application/ports/SessionRepositoryPort';
|
||||
|
||||
export class InMemorySessionRepository implements SessionRepositoryPort {
|
||||
|
||||
@@ -39,7 +39,7 @@ export class GetMembershipFeesUseCase
|
||||
|
||||
const fee = await this.membershipFeeRepository.findByLeagueId(leagueId);
|
||||
|
||||
let payments: any[] = [];
|
||||
let payments: unknown[] = [];
|
||||
if (driverId && fee) {
|
||||
const memberPayments = await this.memberPaymentRepository.findByLeagueIdAndDriverId(leagueId, driverId, this.membershipFeeRepository);
|
||||
payments = memberPayments.map(p => ({
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ApproveLeagueJoinRequestUseCase } from '@core/racing/application/use-cases/ApproveLeagueJoinRequestUseCase';
|
||||
import { ApproveLeagueJoinRequestPresenter } from '@apps/api/src/modules/league/presenters/ApproveLeagueJoinRequestPresenter';
|
||||
import { ILeagueMembershipRepository } from '@core/racing/domain/repositories/ILeagueMembershipRepository';
|
||||
|
||||
|
||||
describe('ApproveLeagueJoinRequestUseCase', () => {
|
||||
let useCase: ApproveLeagueJoinRequestUseCase;
|
||||
@@ -12,7 +12,7 @@ describe('ApproveLeagueJoinRequestUseCase', () => {
|
||||
getJoinRequests: jest.fn(),
|
||||
removeJoinRequest: jest.fn(),
|
||||
saveMembership: jest.fn(),
|
||||
} as any;
|
||||
} as unknown;
|
||||
presenter = new ApproveLeagueJoinRequestPresenter();
|
||||
useCase = new ApproveLeagueJoinRequestUseCase(leagueMembershipRepository);
|
||||
});
|
||||
|
||||
@@ -6,7 +6,7 @@ import { Race } from '@core/racing/domain/entities/Race';
|
||||
import { Result } from '@core/racing/domain/entities/Result';
|
||||
import { League } from '@core/racing/domain/entities/League';
|
||||
import { Standing } from '@core/racing/domain/entities/Standing';
|
||||
import { LeagueMembership } from '@core/racing/domain/entities/LeagueMembership';
|
||||
|
||||
import type { FeedItem } from '@core/social/domain/types/FeedItem';
|
||||
import type {
|
||||
IDashboardOverviewPresenter,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { GetLeagueJoinRequestsUseCase } from '@core/racing/application/use-cases/GetLeagueJoinRequestsUseCase';
|
||||
import { LeagueJoinRequestsPresenter } from '@apps/api/src/modules/league/presenters/LeagueJoinRequestsPresenter';
|
||||
import { ILeagueMembershipRepository } from '@core/racing/domain/repositories/ILeagueMembershipRepository';
|
||||
|
||||
import { IDriverRepository } from '@core/racing/domain/repositories/IDriverRepository';
|
||||
|
||||
describe('GetLeagueJoinRequestsUseCase', () => {
|
||||
@@ -12,10 +12,10 @@ describe('GetLeagueJoinRequestsUseCase', () => {
|
||||
beforeEach(() => {
|
||||
leagueMembershipRepository = {
|
||||
getJoinRequests: jest.fn(),
|
||||
} as any;
|
||||
} as unknown;
|
||||
driverRepository = {
|
||||
findByIds: jest.fn(),
|
||||
} as any;
|
||||
} as unknown;
|
||||
presenter = new LeagueJoinRequestsPresenter();
|
||||
useCase = new GetLeagueJoinRequestsUseCase(leagueMembershipRepository, driverRepository);
|
||||
});
|
||||
|
||||
@@ -2,11 +2,7 @@ import { describe, it, expect, beforeEach } from 'vitest';
|
||||
|
||||
import { JoinLeagueUseCase } from '@core/racing/application/use-cases/JoinLeagueUseCase';
|
||||
import type { ILeagueMembershipRepository } from '@core/racing/domain/repositories/ILeagueMembershipRepository';
|
||||
import {
|
||||
LeagueMembership,
|
||||
type MembershipRole,
|
||||
type MembershipStatus,
|
||||
} from '@core/racing/domain/entities/LeagueMembership';
|
||||
|
||||
|
||||
class InMemoryLeagueMembershipRepository implements ILeagueMembershipRepository {
|
||||
private memberships: LeagueMembership[] = [];
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user