refactor league module (wip)

This commit is contained in:
2025-12-22 12:57:10 +01:00
parent 9da528d5bd
commit 03dc81b0ba
39 changed files with 546 additions and 405 deletions

View File

@@ -4,8 +4,7 @@
* In-memory implementation of IAnalyticsSnapshotRepository for development/testing.
*/
import type { IAnalyticsSnapshotRepository } from '../../domain/repositories/IAnalyticsSnapshotRepository';
import { AnalyticsSnapshot, type SnapshotPeriod, type SnapshotEntityType } from '../../domain/entities/AnalyticsSnapshot';
import { AnalyticsSnapshot, IAnalyticsSnapshotRepository, SnapshotEntityType, SnapshotPeriod } from '@core/analytics';
import { Logger } from '@core/shared/application';
export class InMemoryAnalyticsSnapshotRepository implements IAnalyticsSnapshotRepository {

View File

@@ -1,9 +1,15 @@
import type { LogLevel } from '@core/automation/application/ports/LoggerLogLevel';
enum LogLevel {
DEBUG = 'debug',
INFO = 'info',
WARN = 'warn',
ERROR = 'error',
FATAL = 'fatal'
} // TODO move to core
export type LogEnvironment = 'development' | 'production' | 'test';
export interface LoggingEnvironmentConfig {
level: LogLevel;
level: LogLevel; // TODO
prettyPrint: boolean;
fileOutput: boolean;
filePath?: string;
@@ -46,19 +52,19 @@ function getDefaultsForEnvironment(env: LogEnvironment): LoggingEnvironmentConfi
switch (env) {
case 'development':
return {
level: 'debug',
level: LogLevel.DEBUG,
prettyPrint: true,
fileOutput: false,
};
case 'production':
return {
level: 'info',
level: LogLevel.ERROR,
prettyPrint: false,
fileOutput: true,
};
case 'test':
return {
level: 'warn',
level: LogLevel.WARN,
prettyPrint: false,
fileOutput: false,
};

View File

@@ -0,0 +1,35 @@
export const pointsSystems: Record<string, Record<number, number>> = {
'f1-2024': {
1: 25,
2: 18,
3: 15,
4: 12,
5: 10,
6: 8,
7: 6,
8: 4,
9: 2,
10: 1,
},
indycar: {
1: 50,
2: 40,
3: 35,
4: 32,
5: 30,
6: 28,
7: 26,
8: 24,
9: 22,
10: 20,
11: 19,
12: 18,
13: 17,
14: 16,
15: 15,
},
};
export function getPointsSystems(): Record<string, Record<number, number>> {
return { ...pointsSystems };
}

View File

@@ -4,17 +4,11 @@
* In-memory implementation of IAchievementRepository
*/
import { Logger } from '@core/shared/application';
import {
Achievement,
AchievementCategory,
DRIVER_ACHIEVEMENTS,
STEWARD_ACHIEVEMENTS,
ADMIN_ACHIEVEMENTS,
COMMUNITY_ACHIEVEMENTS,
} from '../../domain/entities/Achievement';
import { UserAchievement } from '../../domain/entities/UserAchievement';
import type { IAchievementRepository } from '../../domain/repositories/IAchievementRepository';
import { Achievement, AchievementCategory, IAchievementRepository, UserAchievement } from "@core/identity";
import { ADMIN_ACHIEVEMENTS, COMMUNITY_ACHIEVEMENTS, DRIVER_ACHIEVEMENTS, STEWARD_ACHIEVEMENTS } from "@core/identity/domain/AchievementConstants";
import { Logger } from "@core/shared/application";
export class InMemoryAchievementRepository implements IAchievementRepository {
private achievements: Map<string, Achievement> = new Map();

View File

@@ -1,10 +1,9 @@
import { User } from '@core/identity/domain/entities/User';
import { 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 { User } from '@core/identity/domain/entities/User';
import { EmailAddress } from '@core/identity/domain/value-objects/EmailAddress';
import { randomUUID } from 'crypto';
import { Logger } from '@core/shared/application';
export class InMemoryAuthRepository implements IAuthRepository {

View File

@@ -4,9 +4,7 @@
* In-memory implementation of ISponsorAccountRepository for development/testing.
*/
import type { ISponsorAccountRepository } from '../../domain/repositories/ISponsorAccountRepository';
import type { SponsorAccount } from '../../domain/entities/SponsorAccount';
import type { UserId } from '../../domain/value-objects/UserId';
import { ISponsorAccountRepository, SponsorAccount, UserId } from '@core/identity';
import { Logger } from '@core/shared/application';
export class InMemorySponsorAccountRepository implements ISponsorAccountRepository {

View File

@@ -4,8 +4,7 @@
* In-memory implementation of IUserRatingRepository
*/
import { UserRating } from '../../domain/value-objects/UserRating';
import type { IUserRatingRepository } from '../../domain/repositories/IUserRatingRepository';
import { IUserRatingRepository, UserRating } from '@core/identity';
import { Logger } from '@core/shared/application';
export class InMemoryUserRatingRepository implements IUserRatingRepository {