website refactor
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
export class TypeOrmPersistenceSchemaError extends Error {
|
||||
export class TypeOrmPersistenceSchemaAdapter extends Error {
|
||||
public readonly entityName: string;
|
||||
public readonly fieldName: string;
|
||||
public readonly reason: string;
|
||||
@@ -12,7 +12,7 @@ export class TypeOrmPersistenceSchemaError extends Error {
|
||||
}) {
|
||||
const errorMessage = params.message || `Schema validation failed for ${params.entityName}.${params.fieldName}: ${params.reason}`;
|
||||
super(errorMessage);
|
||||
this.name = 'TypeOrmPersistenceSchemaError';
|
||||
this.name = 'TypeOrmPersistenceSchemaAdapter';
|
||||
this.entityName = params.entityName;
|
||||
this.fieldName = params.fieldName;
|
||||
this.reason = params.reason;
|
||||
@@ -1,9 +1,9 @@
|
||||
import { Achievement, AchievementCategory, AchievementRequirement } from '@core/identity/domain/entities/Achievement';
|
||||
import { Achievement, AchievementCategory, AchievementRequirement, AchievementProps } from '@core/identity/domain/entities/Achievement';
|
||||
import { UserAchievement } from '@core/identity/domain/entities/UserAchievement';
|
||||
|
||||
import { AchievementOrmEntity } from '../entities/AchievementOrmEntity';
|
||||
import { UserAchievementOrmEntity } from '../entities/UserAchievementOrmEntity';
|
||||
import { TypeOrmPersistenceSchemaError } from '../errors/TypeOrmPersistenceSchemaError';
|
||||
import { TypeOrmPersistenceSchemaAdapter } from '../errors/TypeOrmPersistenceSchemaAdapterError';
|
||||
import {
|
||||
assertArray,
|
||||
assertBoolean,
|
||||
@@ -51,29 +51,29 @@ export class AchievementOrmMapper {
|
||||
|
||||
// Validate requirements structure
|
||||
for (let i = 0; i < entity.requirements.length; i++) {
|
||||
const req = entity.requirements[i];
|
||||
const req = entity.requirements[i] as Record<string, unknown>;
|
||||
const reqField = `requirements[${i}]`;
|
||||
|
||||
if (!req || typeof req !== 'object') {
|
||||
throw new TypeOrmPersistenceSchemaError({
|
||||
throw new TypeOrmPersistenceSchemaAdapter({
|
||||
entityName,
|
||||
fieldName: reqField,
|
||||
reason: 'invalid_requirement_object',
|
||||
});
|
||||
}
|
||||
|
||||
assertNonEmptyString(entityName, `${reqField}.type`, req.type);
|
||||
assertInteger(entityName, `${reqField}.value`, req.value);
|
||||
assertEnumValue(entityName, `${reqField}.operator`, req.operator, VALID_OPERATORS);
|
||||
assertNonEmptyString(entityName, `${reqField}.type`, req.type as string);
|
||||
assertInteger(entityName, `${reqField}.value`, req.value as number);
|
||||
assertEnumValue(entityName, `${reqField}.operator`, req.operator as string, VALID_OPERATORS);
|
||||
}
|
||||
|
||||
try {
|
||||
const createProps: any = {
|
||||
const createProps: Record<string, unknown> = {
|
||||
id: entity.id,
|
||||
name: entity.name,
|
||||
description: entity.description,
|
||||
category: entity.category as AchievementCategory,
|
||||
rarity: entity.rarity as any,
|
||||
rarity: entity.rarity as Achievement['rarity'],
|
||||
points: entity.points,
|
||||
requirements: entity.requirements as AchievementRequirement[],
|
||||
isSecret: entity.isSecret,
|
||||
@@ -84,10 +84,10 @@ export class AchievementOrmMapper {
|
||||
createProps.iconUrl = entity.iconUrl;
|
||||
}
|
||||
|
||||
return Achievement.create(createProps);
|
||||
return Achievement.create(createProps as unknown as AchievementProps);
|
||||
} catch (error) {
|
||||
const message = error instanceof Error ? error.message : 'Invalid persisted Achievement';
|
||||
throw new TypeOrmPersistenceSchemaError({ entityName, fieldName: 'unknown', reason: 'invalid_shape', message });
|
||||
throw new TypeOrmPersistenceSchemaAdapter({ entityName, fieldName: 'unknown', reason: 'invalid_shape', message });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ export class AchievementOrmMapper {
|
||||
});
|
||||
} catch (error) {
|
||||
const message = error instanceof Error ? error.message : 'Invalid persisted UserAchievement';
|
||||
throw new TypeOrmPersistenceSchemaError({ entityName, fieldName: 'unknown', reason: 'invalid_shape', message });
|
||||
throw new TypeOrmPersistenceSchemaAdapter({ entityName, fieldName: 'unknown', reason: 'invalid_shape', message });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { DataSource } from 'typeorm';
|
||||
|
||||
import type { IAchievementRepository } from '@core/identity/domain/repositories/IAchievementRepository';
|
||||
import type { AchievementRepository } from '@core/identity/domain/repositories/AchievementRepository';
|
||||
import type { AchievementCategory } from '@core/identity/domain/entities/Achievement';
|
||||
import { Achievement } from '@core/identity/domain/entities/Achievement';
|
||||
import { UserAchievement } from '@core/identity/domain/entities/UserAchievement';
|
||||
@@ -9,7 +9,7 @@ import { AchievementOrmEntity } from '../entities/AchievementOrmEntity';
|
||||
import { UserAchievementOrmEntity } from '../entities/UserAchievementOrmEntity';
|
||||
import { AchievementOrmMapper } from '../mappers/AchievementOrmMapper';
|
||||
|
||||
export class TypeOrmAchievementRepository implements IAchievementRepository {
|
||||
export class TypeOrmAchievementRepository implements AchievementRepository {
|
||||
constructor(
|
||||
private readonly dataSource: DataSource,
|
||||
private readonly mapper: AchievementOrmMapper,
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
import { TypeOrmPersistenceSchemaError } from '../errors/TypeOrmPersistenceSchemaError';
|
||||
import { TypeOrmPersistenceSchemaAdapter } from '../errors/TypeOrmPersistenceSchemaAdapterError';
|
||||
|
||||
export function assertNonEmptyString(entityName: string, fieldName: string, value: unknown): asserts value is string {
|
||||
if (typeof value !== 'string') {
|
||||
throw new TypeOrmPersistenceSchemaError({ entityName, fieldName, reason: 'not_string' });
|
||||
throw new TypeOrmPersistenceSchemaAdapter({ entityName, fieldName, reason: 'not_string' });
|
||||
}
|
||||
|
||||
if (value.trim().length === 0) {
|
||||
throw new TypeOrmPersistenceSchemaError({ entityName, fieldName, reason: 'empty_string' });
|
||||
throw new TypeOrmPersistenceSchemaAdapter({ entityName, fieldName, reason: 'empty_string' });
|
||||
}
|
||||
}
|
||||
|
||||
export function assertDate(entityName: string, fieldName: string, value: unknown): asserts value is Date {
|
||||
if (!(value instanceof Date)) {
|
||||
throw new TypeOrmPersistenceSchemaError({ entityName, fieldName, reason: 'not_date' });
|
||||
throw new TypeOrmPersistenceSchemaAdapter({ entityName, fieldName, reason: 'not_date' });
|
||||
}
|
||||
if (Number.isNaN(value.getTime())) {
|
||||
throw new TypeOrmPersistenceSchemaError({ entityName, fieldName, reason: 'invalid_date' });
|
||||
throw new TypeOrmPersistenceSchemaAdapter({ entityName, fieldName, reason: 'invalid_date' });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,35 +26,35 @@ export function assertEnumValue<TAllowed extends string>(
|
||||
allowed: readonly TAllowed[],
|
||||
): asserts value is TAllowed {
|
||||
if (typeof value !== 'string') {
|
||||
throw new TypeOrmPersistenceSchemaError({ entityName, fieldName, reason: 'not_string' });
|
||||
throw new TypeOrmPersistenceSchemaAdapter({ entityName, fieldName, reason: 'not_string' });
|
||||
}
|
||||
|
||||
if (!allowed.includes(value as TAllowed)) {
|
||||
throw new TypeOrmPersistenceSchemaError({ entityName, fieldName, reason: 'invalid_enum_value' });
|
||||
throw new TypeOrmPersistenceSchemaAdapter({ entityName, fieldName, reason: 'invalid_enum_value' });
|
||||
}
|
||||
}
|
||||
|
||||
export function assertArray(entityName: string, fieldName: string, value: unknown): asserts value is unknown[] {
|
||||
if (!Array.isArray(value)) {
|
||||
throw new TypeOrmPersistenceSchemaError({ entityName, fieldName, reason: 'not_array' });
|
||||
throw new TypeOrmPersistenceSchemaAdapter({ entityName, fieldName, reason: 'not_array' });
|
||||
}
|
||||
}
|
||||
|
||||
export function assertNumber(entityName: string, fieldName: string, value: unknown): asserts value is number {
|
||||
if (typeof value !== 'number' || Number.isNaN(value)) {
|
||||
throw new TypeOrmPersistenceSchemaError({ entityName, fieldName, reason: 'not_number' });
|
||||
throw new TypeOrmPersistenceSchemaAdapter({ entityName, fieldName, reason: 'not_number' });
|
||||
}
|
||||
}
|
||||
|
||||
export function assertInteger(entityName: string, fieldName: string, value: unknown): asserts value is number {
|
||||
if (typeof value !== 'number' || !Number.isInteger(value)) {
|
||||
throw new TypeOrmPersistenceSchemaError({ entityName, fieldName, reason: 'not_integer' });
|
||||
throw new TypeOrmPersistenceSchemaAdapter({ entityName, fieldName, reason: 'not_integer' });
|
||||
}
|
||||
}
|
||||
|
||||
export function assertBoolean(entityName: string, fieldName: string, value: unknown): asserts value is boolean {
|
||||
if (typeof value !== 'boolean') {
|
||||
throw new TypeOrmPersistenceSchemaError({ entityName, fieldName, reason: 'not_boolean' });
|
||||
throw new TypeOrmPersistenceSchemaAdapter({ entityName, fieldName, reason: 'not_boolean' });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,12 +68,12 @@ export function assertOptionalStringOrNull(
|
||||
}
|
||||
|
||||
if (typeof value !== 'string') {
|
||||
throw new TypeOrmPersistenceSchemaError({ entityName, fieldName, reason: 'not_string' });
|
||||
throw new TypeOrmPersistenceSchemaAdapter({ entityName, fieldName, reason: 'not_string' });
|
||||
}
|
||||
}
|
||||
|
||||
export function assertRecord(entityName: string, fieldName: string, value: unknown): asserts value is Record<string, unknown> {
|
||||
if (typeof value !== 'object' || value === null || Array.isArray(value)) {
|
||||
throw new TypeOrmPersistenceSchemaError({ entityName, fieldName, reason: 'not_object' });
|
||||
throw new TypeOrmPersistenceSchemaAdapter({ entityName, fieldName, reason: 'not_object' });
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import { AnalyticsSnapshot } from '@core/analytics';
|
||||
import type { Logger } from '@core/shared/domain';
|
||||
import { AnalyticsSnapshot } from '@core/analytics/application/repositories/PageViewRepository';
|
||||
import { InMemoryAnalyticsSnapshotRepository } from './InMemoryAnalyticsSnapshotRepository';
|
||||
|
||||
describe('InMemoryAnalyticsSnapshotRepository', () => {
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
* In-memory implementation of IAnalyticsSnapshotRepository for development/testing.
|
||||
*/
|
||||
|
||||
import { AnalyticsSnapshot, IAnalyticsSnapshotRepository, SnapshotEntityType, SnapshotPeriod } from '@core/analytics';
|
||||
import { Logger } from '@core/shared/application';
|
||||
import { AnalyticsSnapshot, IAnalyticsSnapshotRepository, SnapshotEntityType, SnapshotPeriod } from '@core/analytics/application/repositories/PageViewRepository';
|
||||
import { Logger } from '@core/shared/domain/Logger';
|
||||
|
||||
export class InMemoryAnalyticsSnapshotRepository implements IAnalyticsSnapshotRepository {
|
||||
export class InMemoryAnalyticsSnapshotRepository implements AnalyticsSnapshotRepository {
|
||||
private snapshots: Map<string, AnalyticsSnapshot> = new Map();
|
||||
private readonly logger: Logger;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import { EngagementEvent } from '@core/analytics';
|
||||
import type { Logger } from '@core/shared/domain';
|
||||
import { EngagementEvent } from '@core/analytics/application/repositories/PageViewRepository';
|
||||
import { InMemoryEngagementRepository } from './InMemoryEngagementRepository';
|
||||
|
||||
describe('InMemoryEngagementRepository', () => {
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
* In-memory implementation of IEngagementRepository for development/testing.
|
||||
*/
|
||||
|
||||
import type { IEngagementRepository } from '@core/analytics/domain/repositories/IEngagementRepository';
|
||||
import type { EngagementRepository } from '@core/analytics/domain/repositories/EngagementRepository';
|
||||
import { EngagementEvent, type EngagementAction, type EngagementEntityType } from '@core/analytics/domain/entities/EngagementEvent';
|
||||
import { Logger } from '@core/shared/application';
|
||||
import { Logger } from '@core/shared/domain/Logger';
|
||||
|
||||
|
||||
export class InMemoryEngagementRepository implements IEngagementRepository {
|
||||
export class InMemoryEngagementRepository implements EngagementRepository {
|
||||
private events: Map<string, EngagementEvent> = new Map();
|
||||
private logger: Logger;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import { PageView } from '@core/analytics';
|
||||
import type { Logger } from '@core/shared/domain';
|
||||
import { PageView } from '@core/analytics/application/repositories/PageViewRepository';
|
||||
import { InMemoryPageViewRepository } from './InMemoryPageViewRepository';
|
||||
|
||||
describe('InMemoryPageViewRepository', () => {
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
* In-memory implementation of IPageViewRepository for development/testing.
|
||||
*/
|
||||
|
||||
import type { IPageViewRepository } from '@core/analytics/application/repositories/IPageViewRepository';
|
||||
import type { PageViewRepository } from '@core/analytics/application/repositories/PageViewRepository';
|
||||
import { PageView, type EntityType } from '@core/analytics/domain/entities/PageView';
|
||||
import { Logger } from '@core/shared/application';
|
||||
import { Logger } from '@core/shared/domain';
|
||||
|
||||
export class InMemoryPageViewRepository implements IPageViewRepository {
|
||||
export class InMemoryPageViewRepository implements PageViewRepository {
|
||||
private pageViews: Map<string, PageView> = new Map();
|
||||
private logger: Logger;
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { type Repository } from 'typeorm';
|
||||
|
||||
import type { IAnalyticsSnapshotRepository } from '@core/analytics/domain/repositories/IAnalyticsSnapshotRepository';
|
||||
import type { AnalyticsSnapshotRepository } from '@core/analytics/domain/repositories/AnalyticsSnapshotRepository';
|
||||
import type { SnapshotEntityType, SnapshotPeriod } from '@core/analytics/domain/types/AnalyticsSnapshot';
|
||||
import { AnalyticsSnapshot } from '@core/analytics/domain/entities/AnalyticsSnapshot';
|
||||
|
||||
import { AnalyticsSnapshotOrmEntity } from '../entities/AnalyticsSnapshotOrmEntity';
|
||||
import { AnalyticsSnapshotOrmMapper } from '../mappers/AnalyticsSnapshotOrmMapper';
|
||||
|
||||
export class TypeOrmAnalyticsSnapshotRepository implements IAnalyticsSnapshotRepository {
|
||||
export class TypeOrmAnalyticsSnapshotRepository implements AnalyticsSnapshotRepository {
|
||||
constructor(
|
||||
private readonly snapshotRepo: Repository<AnalyticsSnapshotOrmEntity>,
|
||||
private readonly mapper: AnalyticsSnapshotOrmMapper,
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { Between, MoreThanOrEqual, type FindOptionsWhere, type Repository } from 'typeorm';
|
||||
|
||||
import type { IEngagementRepository } from '@core/analytics/domain/repositories/IEngagementRepository';
|
||||
import type { EngagementRepository } from '@core/analytics/domain/repositories/EngagementRepository';
|
||||
import type { EngagementAction, EngagementEntityType } from '@core/analytics/domain/types/EngagementEvent';
|
||||
import { EngagementEvent } from '@core/analytics/domain/entities/EngagementEvent';
|
||||
|
||||
import { EngagementEventOrmEntity } from '../entities/EngagementEventOrmEntity';
|
||||
import { EngagementEventOrmMapper } from '../mappers/EngagementEventOrmMapper';
|
||||
|
||||
export class TypeOrmEngagementRepository implements IEngagementRepository {
|
||||
export class TypeOrmEngagementRepository implements EngagementRepository {
|
||||
constructor(
|
||||
private readonly engagementRepo: Repository<EngagementEventOrmEntity>,
|
||||
private readonly mapper: EngagementEventOrmMapper,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Between, MoreThanOrEqual, type Repository } from 'typeorm';
|
||||
|
||||
import type { IPageViewRepository } from '@core/analytics/application/repositories/IPageViewRepository';
|
||||
import type { PageViewRepository } from '@core/analytics/application/repositories/PageViewRepository';
|
||||
import type { EntityType } from '@core/analytics/domain/types/PageView';
|
||||
import { PageView } from '@core/analytics/domain/entities/PageView';
|
||||
|
||||
@@ -9,7 +9,7 @@ import { PageViewOrmMapper } from '../mappers/PageViewOrmMapper';
|
||||
|
||||
type CountRow = { count: string | number } | null | undefined;
|
||||
|
||||
export class TypeOrmPageViewRepository implements IPageViewRepository {
|
||||
export class TypeOrmPageViewRepository implements PageViewRepository {
|
||||
constructor(
|
||||
private readonly pageViewRepo: Repository<PageViewOrmEntity>,
|
||||
private readonly mapper: PageViewOrmMapper,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
import { SignupWithEmailUseCase } from '@core/identity/application/use-cases/SignupWithEmailUseCase';
|
||||
import { CreateAchievementUseCase } from '@core/identity/application/use-cases/achievement/CreateAchievementUseCase';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import type { Logger } from '@core/shared/domain';
|
||||
|
||||
import {
|
||||
DRIVER_ACHIEVEMENTS,
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
InMemoryLeagueScoringConfigRepository,
|
||||
InMemorySeasonRepository,
|
||||
} from '../racing/persistence/inmemory/InMemoryScoringRepositories';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import type { Logger } from '@core/shared/domain';
|
||||
import { getLeagueScoringPresetById } from './LeagueScoringPresets';
|
||||
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import type { IAuthRepository } from '@core/identity/domain/repositories/IAuthRepository';
|
||||
import type { IPasswordHashingService } from '@core/identity/domain/services/PasswordHashingService';
|
||||
import type { IAdminUserRepository } from '@core/admin/domain/repositories/IAdminUserRepository';
|
||||
import type { Logger } from '@core/shared/domain';
|
||||
import type { AuthRepository } from '@core/identity/domain/repositories/AuthRepository';
|
||||
import type { PasswordHashingService } from '@core/identity/domain/services/PasswordHashingService';
|
||||
import type { AdminUserRepository } from '@core/admin/domain/repositories/AdminUserRepository';
|
||||
import { User } from '@core/identity/domain/entities/User';
|
||||
import { AdminUser } from '@core/admin/domain/entities/AdminUser';
|
||||
import { EmailAddress } from '@core/identity/domain/value-objects/EmailAddress';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import type { IAuthRepository } from '@core/identity/domain/repositories/IAuthRepository';
|
||||
import type { IPasswordHashingService } from '@core/identity/domain/services/PasswordHashingService';
|
||||
import type { IAdminUserRepository } from '@core/admin/domain/repositories/IAdminUserRepository';
|
||||
import type { Logger } from '@core/shared/domain';
|
||||
import type { AuthRepository } from '@core/identity/domain/repositories/AuthRepository';
|
||||
import type { PasswordHashingService } from '@core/identity/domain/services/PasswordHashingService';
|
||||
import type { AdminUserRepository } from '@core/admin/domain/repositories/AdminUserRepository';
|
||||
import { User } from '@core/identity/domain/entities/User';
|
||||
import { AdminUser } from '@core/admin/domain/entities/AdminUser';
|
||||
import { EmailAddress } from '@core/identity/domain/value-objects/EmailAddress';
|
||||
|
||||
@@ -34,7 +34,7 @@ vi.mock('./racing/RacingSeed', () => {
|
||||
};
|
||||
});
|
||||
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import type { Logger } from '@core/shared/domain';
|
||||
import { SeedRacingData, type RacingSeedDependencies } from './SeedRacingData';
|
||||
|
||||
describe('SeedRacingData force reseed behavior', () => {
|
||||
|
||||
@@ -1,39 +1,39 @@
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import type { IDriverRepository } from '@core/racing/domain/repositories/IDriverRepository';
|
||||
import type { ILeagueRepository } from '@core/racing/domain/repositories/ILeagueRepository';
|
||||
import type { IRaceRepository } from '@core/racing/domain/repositories/IRaceRepository';
|
||||
import type { IResultRepository } from '@core/racing/domain/repositories/IResultRepository';
|
||||
import type { IStandingRepository } from '@core/racing/domain/repositories/IStandingRepository';
|
||||
import type { ILeagueMembershipRepository } from '@core/racing/domain/repositories/ILeagueMembershipRepository';
|
||||
import type { IRaceRegistrationRepository } from '@core/racing/domain/repositories/IRaceRegistrationRepository';
|
||||
import type { ITeamRepository } from '@core/racing/domain/repositories/ITeamRepository';
|
||||
import type { ITeamMembershipRepository } from '@core/racing/domain/repositories/ITeamMembershipRepository';
|
||||
import type { ISponsorRepository } from '@core/racing/domain/repositories/ISponsorRepository';
|
||||
import type { ISeasonRepository } from '@core/racing/domain/repositories/ISeasonRepository';
|
||||
import type { ILeagueScoringConfigRepository } from '@core/racing/domain/repositories/ILeagueScoringConfigRepository';
|
||||
import type { ISeasonSponsorshipRepository } from '@core/racing/domain/repositories/ISeasonSponsorshipRepository';
|
||||
import type { ISponsorshipRequestRepository } from '@core/racing/domain/repositories/ISponsorshipRequestRepository';
|
||||
import type { ILeagueWalletRepository } from '@core/racing/domain/repositories/ILeagueWalletRepository';
|
||||
import type { ITransactionRepository } from '@core/racing/domain/repositories/ITransactionRepository';
|
||||
import type { Logger } from '@core/shared/domain';
|
||||
import type { DriverRepository } from '@core/racing/domain/repositories/DriverRepository';
|
||||
import type { LeagueRepository } from '@core/racing/domain/repositories/LeagueRepository';
|
||||
import type { RaceRepository } from '@core/racing/domain/repositories/RaceRepository';
|
||||
import type { ResultRepository } from '@core/racing/domain/repositories/ResultRepository';
|
||||
import type { StandingRepository } from '@core/racing/domain/repositories/StandingRepository';
|
||||
import type { LeagueMembershipRepository } from '@core/racing/domain/repositories/LeagueMembershipRepository';
|
||||
import type { RaceRegistrationRepository } from '@core/racing/domain/repositories/RaceRegistrationRepository';
|
||||
import type { TeamRepository } from '@core/racing/domain/repositories/TeamRepository';
|
||||
import type { TeamMembershipRepository } from '@core/racing/domain/repositories/TeamMembershipRepository';
|
||||
import type { SponsorRepository } from '@core/racing/domain/repositories/SponsorRepository';
|
||||
import type { SeasonRepository } from '@core/racing/domain/repositories/SeasonRepository';
|
||||
import type { LeagueScoringConfigRepository } from '@core/racing/domain/repositories/LeagueScoringConfigRepository';
|
||||
import type { SeasonSponsorshipRepository } from '@core/racing/domain/repositories/SeasonSponsorshipRepository';
|
||||
import type { SponsorshipRequestRepository } from '@core/racing/domain/repositories/SponsorshipRequestRepository';
|
||||
import type { LeagueWalletRepository } from '@core/racing/domain/repositories/LeagueWalletRepository';
|
||||
import type { TransactionRepository } from '@core/racing/domain/repositories/TransactionRepository';
|
||||
import type { Season } from '@core/racing/domain/entities/season/Season';
|
||||
import { getLeagueScoringPresetById } from './LeagueScoringPresets';
|
||||
import type { IProtestRepository } from '@core/racing/domain/repositories/IProtestRepository';
|
||||
import type { IPenaltyRepository } from '@core/racing/domain/repositories/IPenaltyRepository';
|
||||
import type { IFeedRepository } from '@core/social/domain/repositories/IFeedRepository';
|
||||
import type { ISocialGraphRepository } from '@core/social/domain/repositories/ISocialGraphRepository';
|
||||
import type { IDriverStatsRepository } from '@core/racing/domain/repositories/IDriverStatsRepository';
|
||||
import type { ITeamStatsRepository, TeamStats } from '@core/racing/domain/repositories/ITeamStatsRepository';
|
||||
import type { IMediaRepository } from '@core/racing/domain/repositories/IMediaRepository';
|
||||
import type { IAuthRepository } from '@core/identity/domain/repositories/IAuthRepository';
|
||||
import type { IPasswordHashingService } from '@core/identity/domain/services/PasswordHashingService';
|
||||
import type { IAdminUserRepository } from '@core/admin/domain/repositories/IAdminUserRepository';
|
||||
import type { ProtestRepository } from '@core/racing/domain/repositories/ProtestRepository';
|
||||
import type { PenaltyRepository } from '@core/racing/domain/repositories/PenaltyRepository';
|
||||
import type { FeedRepository } from '@core/social/domain/repositories/FeedRepository';
|
||||
import type { SocialGraphRepository } from '@core/social/domain/repositories/SocialGraphRepository';
|
||||
import type { DriverStatsRepository } from '@core/racing/domain/repositories/DriverStatsRepository';
|
||||
import type { TeamStatsRepository, TeamStats } from '@core/racing/domain/repositories/TeamStatsRepository';
|
||||
import type { MediaRepository } from '@core/racing/domain/repositories/MediaRepository';
|
||||
import type { AuthRepository } from '@core/identity/domain/repositories/AuthRepository';
|
||||
import type { PasswordHashingService } from '@core/identity/domain/services/PasswordHashingService';
|
||||
import type { AdminUserRepository } from '@core/admin/domain/repositories/AdminUserRepository';
|
||||
import { createRacingSeed } from './racing/RacingSeed';
|
||||
import { seedId } from './racing/SeedIdHelper';
|
||||
import { Driver } from '@core/racing/domain/entities/Driver';
|
||||
import { Result } from '@core/racing/domain/entities/result/Result';
|
||||
import { Standing } from '@core/racing/domain/entities/Standing';
|
||||
import { Team } from '@core/racing/domain/entities/Team';
|
||||
import type { DriverStats } from '@core/racing/application/use-cases/IDriverStatsUseCase';
|
||||
import type { DriverStats } from '@core/racing/application/use-cases/DriverStatsUseCase';
|
||||
|
||||
export type RacingSeedDependencies = {
|
||||
driverRepository: IDriverRepository;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import type { Logger } from '@core/shared/domain';
|
||||
import type { UserAchievement } from '@core/identity';
|
||||
import { InMemoryAchievementRepository } from './InMemoryAchievementRepository';
|
||||
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
|
||||
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";
|
||||
import { Logger } from "@core/shared/domain";
|
||||
|
||||
|
||||
|
||||
export class InMemoryAchievementRepository implements IAchievementRepository {
|
||||
export class InMemoryAchievementRepository implements AchievementRepository {
|
||||
private achievements: Map<string, Achievement> = new Map();
|
||||
private userAchievements: Map<string, UserAchievement> = new Map();
|
||||
private readonly logger: Logger;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import type { Logger } from '@core/shared/domain';
|
||||
import { UserId } from '@core/identity';
|
||||
import { User } from '@core/identity/domain/entities/User';
|
||||
import { InMemoryUserRepository } from './InMemoryUserRepository';
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
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 { AuthRepository } from '@core/identity/domain/repositories/AuthRepository';
|
||||
import { UserRepository, StoredUser } from '@core/identity/domain/repositories/UserRepository';
|
||||
import { PasswordHashingService } from '@core/identity/domain/services/PasswordHashingService';
|
||||
|
||||
import { EmailAddress } from '@core/identity/domain/value-objects/EmailAddress';
|
||||
import { Logger } from '@core/shared/application';
|
||||
import { Logger } from '@core/shared/domain';
|
||||
|
||||
export class InMemoryAuthRepository implements IAuthRepository {
|
||||
export class InMemoryAuthRepository implements AuthRepository {
|
||||
constructor(
|
||||
private readonly userRepository: IUserRepository,
|
||||
private readonly passwordHashingService: IPasswordHashingService,
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { Company } from '@core/identity/domain/entities/Company';
|
||||
import { ICompanyRepository } from '@core/identity/domain/repositories/ICompanyRepository';
|
||||
import { CompanyRepository } from '@core/identity/domain/repositories/CompanyRepository';
|
||||
|
||||
/**
|
||||
* In-memory implementation of ICompanyRepository for testing
|
||||
*/
|
||||
export class InMemoryCompanyRepository implements ICompanyRepository {
|
||||
export class InMemoryCompanyRepository implements CompanyRepository {
|
||||
private companies: Map<string, Company> = new Map();
|
||||
|
||||
create(company: Pick<Company, 'getName' | 'getOwnerUserId' | 'getContactEmail'>): Company {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { IExternalGameRatingRepository, PaginatedQueryOptions, PaginatedResult } from '@core/identity/domain/repositories/IExternalGameRatingRepository';
|
||||
import { ExternalGameRatingRepository, PaginatedQueryOptions, PaginatedResult } from '@core/identity/domain/repositories/ExternalGameRatingRepository';
|
||||
import { ExternalGameRatingProfile } from '@core/identity/domain/entities/ExternalGameRatingProfile';
|
||||
|
||||
/**
|
||||
@@ -6,7 +6,7 @@ import { ExternalGameRatingProfile } from '@core/identity/domain/entities/Extern
|
||||
*
|
||||
* For testing and development purposes.
|
||||
*/
|
||||
export class InMemoryExternalGameRatingRepository implements IExternalGameRatingRepository {
|
||||
export class InMemoryExternalGameRatingRepository implements ExternalGameRatingRepository {
|
||||
private profiles: Map<string, ExternalGameRatingProfile> = new Map();
|
||||
|
||||
private getKey(userId: string, gameKey: string): string {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { IMagicLinkRepository, PasswordResetRequest } from '@core/identity/domain/repositories/IMagicLinkRepository';
|
||||
import { Result } from '@core/shared/application/Result';
|
||||
import { Logger } from '@core/shared/application';
|
||||
import { MagicLinkRepository, PasswordResetRequest } from '@core/identity/domain/repositories/MagicLinkRepository';
|
||||
import { Result } from '@core/shared/domain/Result';
|
||||
import { Logger } from '@core/shared/domain';
|
||||
|
||||
export class InMemoryMagicLinkRepository implements IMagicLinkRepository {
|
||||
export class InMemoryMagicLinkRepository implements MagicLinkRepository {
|
||||
private resetRequests: Map<string, PasswordResetRequest> = new Map();
|
||||
private rateLimitStore: Map<string, { count: number; lastRequest: Date }> = new Map();
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import type { Logger } from '@core/shared/domain';
|
||||
import { UserId, type SponsorAccount } from '@core/identity';
|
||||
import { InMemorySponsorAccountRepository } from './InMemorySponsorAccountRepository';
|
||||
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
* In-memory implementation of ISponsorAccountRepository for development/testing.
|
||||
*/
|
||||
|
||||
import { ISponsorAccountRepository, SponsorAccount, UserId } from '@core/identity';
|
||||
import { Logger } from '@core/shared/application';
|
||||
import { SponsorAccountRepository, SponsorAccount, UserId } from '@core/identity';
|
||||
import { Logger } from '@core/shared/domain';
|
||||
|
||||
export class InMemorySponsorAccountRepository implements ISponsorAccountRepository {
|
||||
export class InMemorySponsorAccountRepository implements SponsorAccountRepository {
|
||||
private accounts: Map<string, SponsorAccount> = new Map();
|
||||
private readonly logger: Logger;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import type { Logger } from '@core/shared/domain';
|
||||
import type { UserRating } from '@core/identity';
|
||||
import { InMemoryUserRatingRepository } from './InMemoryUserRatingRepository';
|
||||
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
* In-memory implementation of IUserRatingRepository
|
||||
*/
|
||||
|
||||
import { IUserRatingRepository, UserRating } from '@core/identity';
|
||||
import { Logger } from '@core/shared/application';
|
||||
import { UserRatingRepository, UserRating } from '@core/identity';
|
||||
import { Logger } from '@core/shared/domain';
|
||||
|
||||
export class InMemoryUserRatingRepository implements IUserRatingRepository {
|
||||
export class InMemoryUserRatingRepository implements UserRatingRepository {
|
||||
private ratings: Map<string, UserRating> = new Map();
|
||||
private readonly logger: Logger;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import type { StoredUser } from '@core/identity/domain/repositories/IUserRepository';
|
||||
import type { Logger } from '@core/shared/domain';
|
||||
import type { StoredUser } from '@core/identity/domain/repositories/UserRepository';
|
||||
import { InMemoryUserRepository } from './InMemoryUserRepository';
|
||||
|
||||
describe('InMemoryUserRepository', () => {
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
* Stores users in memory for demo/development purposes.
|
||||
*/
|
||||
|
||||
import { Logger } from '@core/shared/application';
|
||||
import type { IUserRepository, StoredUser } from '@core/identity/domain/repositories/IUserRepository';
|
||||
import { Logger } from '@core/shared/domain';
|
||||
import type { UserRepository, StoredUser } from '@core/identity/domain/repositories/UserRepository';
|
||||
|
||||
export class InMemoryUserRepository implements IUserRepository {
|
||||
export class InMemoryUserRepository implements UserRepository {
|
||||
private users: Map<string, StoredUser> = new Map();
|
||||
private emailIndex: Map<string, string> = new Map(); // email -> userId
|
||||
private readonly logger: Logger;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { User } from '@core/identity/domain/entities/User';
|
||||
import type { StoredUser } from '@core/identity/domain/repositories/IUserRepository';
|
||||
import type { StoredUser } from '@core/identity/domain/repositories/UserRepository';
|
||||
import { PasswordHash } from '@core/identity/domain/value-objects/PasswordHash';
|
||||
|
||||
import { UserOrmEntity } from '../entities/UserOrmEntity';
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import type { DataSource } from 'typeorm';
|
||||
|
||||
import { User } from '@core/identity/domain/entities/User';
|
||||
import type { IAuthRepository } from '@core/identity/domain/repositories/IAuthRepository';
|
||||
import type { AuthRepository } from '@core/identity/domain/repositories/AuthRepository';
|
||||
import type { EmailAddress } from '@core/identity/domain/value-objects/EmailAddress';
|
||||
|
||||
import { UserOrmEntity } from '../entities/UserOrmEntity';
|
||||
import { UserOrmMapper } from '../mappers/UserOrmMapper';
|
||||
|
||||
export class TypeOrmAuthRepository implements IAuthRepository {
|
||||
export class TypeOrmAuthRepository implements AuthRepository {
|
||||
constructor(
|
||||
private readonly dataSource: DataSource,
|
||||
private readonly mapper: UserOrmMapper,
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import type { DataSource } from 'typeorm';
|
||||
|
||||
import { Company } from '@core/identity/domain/entities/Company';
|
||||
import type { ICompanyRepository } from '@core/identity/domain/repositories/ICompanyRepository';
|
||||
import type { CompanyRepository } from '@core/identity/domain/repositories/CompanyRepository';
|
||||
|
||||
import { CompanyOrmEntity } from '../entities/CompanyOrmEntity';
|
||||
import { CompanyOrmMapper } from '../mappers/CompanyOrmMapper';
|
||||
|
||||
export class TypeOrmCompanyRepository implements ICompanyRepository {
|
||||
export class TypeOrmCompanyRepository implements CompanyRepository {
|
||||
constructor(
|
||||
private readonly dataSource: DataSource,
|
||||
private readonly mapper: CompanyOrmMapper,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Repository } from 'typeorm';
|
||||
import { IExternalGameRatingRepository, PaginatedQueryOptions, PaginatedResult } from '@core/identity/domain/repositories/IExternalGameRatingRepository';
|
||||
import { ExternalGameRatingRepository, PaginatedQueryOptions, PaginatedResult } from '@core/identity/domain/repositories/ExternalGameRatingRepository';
|
||||
import { ExternalGameRatingProfile } from '@core/identity/domain/entities/ExternalGameRatingProfile';
|
||||
import { ExternalGameRatingProfileOrmEntity } from '../entities/ExternalGameRatingProfileOrmEntity';
|
||||
import { ExternalGameRatingProfileOrmMapper } from '../mappers/ExternalGameRatingProfileOrmMapper';
|
||||
@@ -10,7 +10,7 @@ import { ExternalGameRatingProfileOrmMapper } from '../mappers/ExternalGameRatin
|
||||
* Repository for external game rating profiles using TypeORM.
|
||||
* Implements store/display operations only, no compute.
|
||||
*/
|
||||
export class TypeOrmExternalGameRatingRepository implements IExternalGameRatingRepository {
|
||||
export class TypeOrmExternalGameRatingRepository implements ExternalGameRatingRepository {
|
||||
constructor(
|
||||
private readonly repository: Repository<ExternalGameRatingProfileOrmEntity>
|
||||
) {}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import type { DataSource } from 'typeorm';
|
||||
import { IMagicLinkRepository, PasswordResetRequest } from '@core/identity/domain/repositories/IMagicLinkRepository';
|
||||
import { Result } from '@core/shared/application/Result';
|
||||
import { Logger } from '@core/shared/application';
|
||||
import { MagicLinkRepository, PasswordResetRequest } from '@core/identity/domain/repositories/MagicLinkRepository';
|
||||
import { Result } from '@core/shared/domain/Result';
|
||||
import { Logger } from '@core/shared/domain';
|
||||
import { PasswordResetRequestOrmEntity } from '../entities/PasswordResetRequestOrmEntity';
|
||||
|
||||
export class TypeOrmMagicLinkRepository implements IMagicLinkRepository {
|
||||
export class TypeOrmMagicLinkRepository implements MagicLinkRepository {
|
||||
// Rate limit: max 3 requests per 15 minutes
|
||||
private readonly RATE_LIMIT_MAX = 3;
|
||||
private readonly RATE_LIMIT_WINDOW = 15 * 60 * 1000; // 15 minutes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { DataSource } from 'typeorm';
|
||||
|
||||
import type { IRatingEventRepository, FindByUserIdOptions, PaginatedQueryOptions, PaginatedResult } from '@core/identity/domain/repositories/IRatingEventRepository';
|
||||
import type { RatingEventRepository, FindByUserIdOptions, PaginatedQueryOptions, PaginatedResult } from '@core/identity/domain/repositories/RatingEventRepository';
|
||||
import type { RatingEvent } from '@core/identity/domain/entities/RatingEvent';
|
||||
import type { RatingEventId } from '@core/identity/domain/value-objects/RatingEventId';
|
||||
|
||||
@@ -13,7 +13,7 @@ import { RatingEventOrmMapper } from '../mappers/RatingEventOrmMapper';
|
||||
* Persists rating events in the ledger with efficient querying by userId
|
||||
* and ordering for snapshot computation.
|
||||
*/
|
||||
export class TypeOrmRatingEventRepository implements IRatingEventRepository {
|
||||
export class TypeOrmRatingEventRepository implements RatingEventRepository {
|
||||
constructor(private readonly dataSource: DataSource) {}
|
||||
|
||||
async save(event: RatingEvent): Promise<RatingEvent> {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { DataSource } from 'typeorm';
|
||||
|
||||
import type { IUserRatingRepository } from '@core/identity/domain/repositories/IUserRatingRepository';
|
||||
import type { UserRatingRepository } from '@core/identity/domain/repositories/UserRatingRepository';
|
||||
import type { UserRating } from '@core/identity/domain/value-objects/UserRating';
|
||||
|
||||
import { UserRatingOrmEntity } from '../entities/UserRatingOrmEntity';
|
||||
@@ -11,7 +11,7 @@ import { UserRatingOrmMapper } from '../mappers/UserRatingOrmMapper';
|
||||
*
|
||||
* Persists and retrieves UserRating snapshots for fast reads.
|
||||
*/
|
||||
export class TypeOrmUserRatingRepository implements IUserRatingRepository {
|
||||
export class TypeOrmUserRatingRepository implements UserRatingRepository {
|
||||
constructor(private readonly dataSource: DataSource) {}
|
||||
|
||||
async findByUserId(userId: string): Promise<UserRating | null> {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import type { DataSource } from 'typeorm';
|
||||
|
||||
import type { IUserRepository, StoredUser } from '@core/identity/domain/repositories/IUserRepository';
|
||||
import type { UserRepository, StoredUser } from '@core/identity/domain/repositories/UserRepository';
|
||||
|
||||
import { UserOrmEntity } from '../entities/UserOrmEntity';
|
||||
import { UserOrmMapper } from '../mappers/UserOrmMapper';
|
||||
|
||||
export class TypeOrmUserRepository implements IUserRepository {
|
||||
export class TypeOrmUserRepository implements UserRepository {
|
||||
constructor(
|
||||
private readonly dataSource: DataSource,
|
||||
private readonly mapper: UserOrmMapper,
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
* NOT FOR PRODUCTION USE - uses a simple string reversal as "hashing".
|
||||
*/
|
||||
|
||||
import type { IPasswordHashingService } from '@core/identity/domain/services/PasswordHashingService';
|
||||
import type { PasswordHashingService } from '@core/identity/domain/services/PasswordHashingService';
|
||||
|
||||
export class InMemoryPasswordHashingService implements IPasswordHashingService {
|
||||
export class InMemoryPasswordHashingService implements PasswordHashingService {
|
||||
async hash(plain: string): Promise<string> {
|
||||
// In a real application, use a robust hashing library like bcrypt or Argon2.
|
||||
// For demo, we'll just reverse the password and add a salt-like prefix.
|
||||
|
||||
@@ -2,7 +2,7 @@ import { randomUUID } from 'node:crypto';
|
||||
|
||||
import type { AuthenticatedUser } from '@core/identity/application/ports/IdentityProviderPort';
|
||||
import type { AuthSession, IdentitySessionPort } from '@core/identity/application/ports/IdentitySessionPort';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import type { Logger } from '@core/shared/domain';
|
||||
import { tryGetHttpRequestContext } from '@adapters/http/RequestContext';
|
||||
|
||||
const COOKIE_NAME = 'gp_session';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ErrorReporter } from "@core/shared/application";
|
||||
import { ErrorReporter } from "@core/shared/domain";
|
||||
|
||||
export class ConsoleErrorReporter implements ErrorReporter {
|
||||
report(error: Error, context?: unknown): void {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Logger } from "@core/shared/application";
|
||||
import { Logger } from "@core/shared/domain";
|
||||
|
||||
export class ConsoleLogger implements Logger {
|
||||
private formatMessage(level: string, message: string, context?: unknown): string {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import type { Logger } from '@core/shared/domain';
|
||||
import { AvatarGenerationRequest } from '@core/media/domain/entities/AvatarGenerationRequest';
|
||||
import { InMemoryAvatarGenerationRepository } from './InMemoryAvatarGenerationRepository';
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { IAvatarGenerationRepository } from '@core/media/domain/repositories/IAvatarGenerationRepository';
|
||||
import { AvatarGenerationRepository } from '@core/media/domain/repositories/AvatarGenerationRepository';
|
||||
import { AvatarGenerationRequest } from '@core/media/domain/entities/AvatarGenerationRequest';
|
||||
import { Logger } from '@core/shared/application';
|
||||
import { Logger } from '@core/shared/domain';
|
||||
|
||||
export class InMemoryAvatarGenerationRepository implements IAvatarGenerationRepository {
|
||||
export class InMemoryAvatarGenerationRepository implements AvatarGenerationRepository {
|
||||
private requests: Map<string, AvatarGenerationRequest> = new Map(); // Key: requestId
|
||||
private userRequests: Map<string, AvatarGenerationRequest[]> = new Map(); // Key: userId
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import type { DataSource } from 'typeorm';
|
||||
import type { IAvatarGenerationRepository } from '@core/media/domain/repositories/IAvatarGenerationRepository';
|
||||
import type { AvatarGenerationRepository } from '@core/media/domain/repositories/AvatarGenerationRepository';
|
||||
import type { AvatarGenerationRequest } from '@core/media/domain/entities/AvatarGenerationRequest';
|
||||
import { AvatarGenerationRequestOrmEntity } from '../entities/AvatarGenerationRequestOrmEntity';
|
||||
import { AvatarGenerationRequestOrmMapper } from '../mappers/AvatarGenerationRequestOrmMapper';
|
||||
|
||||
export class TypeOrmAvatarGenerationRepository implements IAvatarGenerationRepository {
|
||||
export class TypeOrmAvatarGenerationRepository implements AvatarGenerationRepository {
|
||||
constructor(
|
||||
private readonly dataSource: DataSource,
|
||||
private readonly mapper: AvatarGenerationRequestOrmMapper,
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import type { DataSource } from 'typeorm';
|
||||
import type { IAvatarRepository } from '@core/media/domain/repositories/IAvatarRepository';
|
||||
import type { AvatarRepository } from '@core/media/domain/repositories/AvatarRepository';
|
||||
import type { Avatar } from '@core/media/domain/entities/Avatar';
|
||||
import { AvatarOrmEntity } from '../entities/AvatarOrmEntity';
|
||||
import { AvatarOrmMapper } from '../mappers/AvatarOrmMapper';
|
||||
|
||||
export class TypeOrmAvatarRepository implements IAvatarRepository {
|
||||
export class TypeOrmAvatarRepository implements AvatarRepository {
|
||||
constructor(
|
||||
private readonly dataSource: DataSource,
|
||||
private readonly mapper: AvatarOrmMapper,
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import type { DataSource } from 'typeorm';
|
||||
import type { IMediaRepository } from '@core/media/domain/repositories/IMediaRepository';
|
||||
import type { MediaRepository } from '@core/media/domain/repositories/MediaRepository';
|
||||
import type { Media } from '@core/media/domain/entities/Media';
|
||||
import { MediaOrmEntity } from '../entities/MediaOrmEntity';
|
||||
import { MediaOrmMapper } from '../mappers/MediaOrmMapper';
|
||||
|
||||
export class TypeOrmMediaRepository implements IMediaRepository {
|
||||
export class TypeOrmMediaRepository implements MediaRepository {
|
||||
constructor(
|
||||
private readonly dataSource: DataSource,
|
||||
private readonly mapper: MediaOrmMapper,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it, vi } from 'vitest';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import type { Logger } from '@core/shared/domain';
|
||||
import { InMemoryFaceValidationAdapter } from './InMemoryFaceValidationAdapter';
|
||||
|
||||
describe('InMemoryFaceValidationAdapter', () => {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { FaceValidationPort, FaceValidationResult } from '@core/media/application/ports/FaceValidationPort';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import type { Logger } from '@core/shared/domain';
|
||||
|
||||
export class InMemoryFaceValidationAdapter implements FaceValidationPort {
|
||||
constructor(private readonly logger: Logger) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it, vi } from 'vitest';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import type { Logger } from '@core/shared/domain';
|
||||
import { InMemoryImageServiceAdapter } from './InMemoryImageServiceAdapter';
|
||||
|
||||
describe('InMemoryImageServiceAdapter', () => {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { IImageServicePort } from '@core/racing/application/ports/IImageServicePort';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import type { ImageServicePort } from '@core/racing/application/ports/ImageServicePort';
|
||||
import type { Logger } from '@core/shared/domain';
|
||||
|
||||
export class InMemoryImageServiceAdapter implements IImageServicePort {
|
||||
export class InMemoryImageServiceAdapter implements ImageServicePort {
|
||||
constructor(private readonly logger: Logger) {
|
||||
this.logger.info('InMemoryImageServiceAdapter initialized.');
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import type {
|
||||
NotificationDeliveryResult
|
||||
} from '@core/notifications/application/ports/NotificationGateway';
|
||||
|
||||
export class NotificationGatewayRegistry implements INotificationGatewayRegistry {
|
||||
export class NotificationGatewayRegistry implements NotificationGatewayRegistry {
|
||||
private gateways: Map<NotificationChannel, NotificationGateway> = new Map();
|
||||
|
||||
constructor(initialGateways: NotificationGateway[] = []) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import type { Logger } from '@core/shared/domain';
|
||||
import { NotificationPreference } from '@core/notifications/domain/entities/NotificationPreference';
|
||||
import { InMemoryNotificationPreferenceRepository } from './InMemoryNotificationPreferenceRepository';
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { INotificationPreferenceRepository } from '@core/notifications/domain/repositories/INotificationPreferenceRepository';
|
||||
import { NotificationPreferenceRepository } from '@core/notifications/domain/repositories/NotificationPreferenceRepository';
|
||||
import { NotificationPreference } from '@core/notifications/domain/entities/NotificationPreference';
|
||||
import { Logger } from '@core/shared/application';
|
||||
import { Logger } from '@core/shared/domain';
|
||||
|
||||
export class InMemoryNotificationPreferenceRepository implements INotificationPreferenceRepository {
|
||||
export class InMemoryNotificationPreferenceRepository implements NotificationPreferenceRepository {
|
||||
private preferences: Map<string, NotificationPreference> = new Map();
|
||||
|
||||
constructor(private readonly logger: Logger, initialPreferences: NotificationPreference[] = []) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import type { Logger } from '@core/shared/domain';
|
||||
import { Notification } from '@core/notifications/domain/entities/Notification';
|
||||
import { InMemoryNotificationRepository } from './InMemoryNotificationRepository';
|
||||
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
*/
|
||||
|
||||
import { Notification } from '@core/notifications/domain/entities/Notification';
|
||||
import type { INotificationRepository } from '@core/notifications/domain/repositories/INotificationRepository';
|
||||
import type { NotificationRepository } from '@core/notifications/domain/repositories/NotificationRepository';
|
||||
import type { NotificationType } from '@core/notifications/domain/types/NotificationTypes';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import type { Logger } from '@core/shared/domain';
|
||||
|
||||
export class InMemoryNotificationRepository implements INotificationRepository {
|
||||
export class InMemoryNotificationRepository implements NotificationRepository {
|
||||
private notifications: Map<string, Notification> = new Map();
|
||||
private readonly logger: Logger;
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import type { DataSource } from 'typeorm';
|
||||
import type { INotificationPreferenceRepository } from '@core/notifications/domain/repositories/INotificationPreferenceRepository';
|
||||
import type { NotificationPreferenceRepository } from '@core/notifications/domain/repositories/NotificationPreferenceRepository';
|
||||
import { NotificationPreference } from '@core/notifications/domain/entities/NotificationPreference';
|
||||
import { NotificationPreferenceOrmEntity } from '../entities/NotificationPreferenceOrmEntity';
|
||||
import { NotificationPreferenceOrmMapper } from '../mappers/NotificationPreferenceOrmMapper';
|
||||
|
||||
export class TypeOrmNotificationPreferenceRepository implements INotificationPreferenceRepository {
|
||||
export class TypeOrmNotificationPreferenceRepository implements NotificationPreferenceRepository {
|
||||
constructor(
|
||||
private readonly dataSource: DataSource,
|
||||
private readonly mapper: NotificationPreferenceOrmMapper,
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import type { DataSource } from 'typeorm';
|
||||
import type { INotificationRepository } from '@core/notifications/domain/repositories/INotificationRepository';
|
||||
import type { NotificationRepository } from '@core/notifications/domain/repositories/NotificationRepository';
|
||||
import type { NotificationType } from '@core/notifications/domain/types/NotificationTypes';
|
||||
import { Notification } from '@core/notifications/domain/entities/Notification';
|
||||
import { NotificationOrmEntity } from '../entities/NotificationOrmEntity';
|
||||
import { NotificationOrmMapper } from '../mappers/NotificationOrmMapper';
|
||||
|
||||
export class TypeOrmNotificationRepository implements INotificationRepository {
|
||||
export class TypeOrmNotificationRepository implements NotificationRepository {
|
||||
constructor(
|
||||
private readonly dataSource: DataSource,
|
||||
private readonly mapper: NotificationOrmMapper,
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { IMagicLinkNotificationPort, MagicLinkNotificationInput } from '@core/identity/domain/ports/IMagicLinkNotificationPort';
|
||||
import { Logger } from '@core/shared/application';
|
||||
import { MagicLinkNotificationPort, MagicLinkNotificationInput } from '@core/identity/domain/ports/MagicLinkNotificationPort';
|
||||
import { Logger } from '@core/shared/domain';
|
||||
|
||||
/**
|
||||
* Console adapter for magic link notifications
|
||||
* Logs to console for development/testing purposes
|
||||
*/
|
||||
export class ConsoleMagicLinkNotificationAdapter implements IMagicLinkNotificationPort {
|
||||
export class ConsoleMagicLinkNotificationAdapter implements MagicLinkNotificationPort {
|
||||
constructor(private readonly logger: Logger) {}
|
||||
|
||||
async sendMagicLink(input: MagicLinkNotificationInput): Promise<void> {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import type { NotificationService, SendNotificationCommand } from '@core/notifications/application/ports/NotificationService';
|
||||
import type { INotificationRepository } from '@core/notifications/domain/repositories/INotificationRepository';
|
||||
import type { INotificationPreferenceRepository } from '@core/notifications/domain/repositories/INotificationPreferenceRepository';
|
||||
import type { NotificationRepository } from '@core/notifications/domain/repositories/NotificationRepository';
|
||||
import type { NotificationPreferenceRepository } from '@core/notifications/domain/repositories/NotificationPreferenceRepository';
|
||||
import type { NotificationGatewayRegistry } from '@core/notifications/application/ports/NotificationGateway';
|
||||
import { SendNotificationUseCase } from '@core/notifications/application/use-cases/SendNotificationUseCase';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import type { Logger } from '@core/shared/domain';
|
||||
|
||||
export class NotificationServiceAdapter implements NotificationService {
|
||||
private readonly useCase: SendNotificationUseCase;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import type { Logger } from '@core/shared/application/Logger';
|
||||
import type { Logger } from '@core/shared/domain/Logger';
|
||||
import type { MembershipFee } from '@core/payments/domain/entities/MembershipFee';
|
||||
import { MembershipFeeType } from '@core/payments/domain/entities/MembershipFee';
|
||||
import type { MemberPayment } from '@core/payments/domain/entities/MemberPayment';
|
||||
|
||||
@@ -2,15 +2,15 @@
|
||||
* In-Memory Implementation: InMemoryMembershipFeeRepository
|
||||
*/
|
||||
|
||||
import type { Logger } from '@core/shared/application/Logger';
|
||||
import type { IMembershipFeeRepository, IMemberPaymentRepository } from '@core/payments/domain/repositories/IMembershipFeeRepository';
|
||||
import type { Logger } from '@core/shared/domain/Logger';
|
||||
import type { MembershipFeeRepository, IMemberPaymentRepository } from '@core/payments/domain/repositories/MembershipFeeRepository';
|
||||
import type { MembershipFee } from '@core/payments/domain/entities/MembershipFee';
|
||||
import type { MemberPayment } from '@core/payments/domain/entities/MemberPayment';
|
||||
|
||||
const membershipFees: Map<string, MembershipFee> = new Map();
|
||||
const memberPayments: Map<string, MemberPayment> = new Map();
|
||||
|
||||
export class InMemoryMembershipFeeRepository implements IMembershipFeeRepository {
|
||||
export class InMemoryMembershipFeeRepository implements MembershipFeeRepository {
|
||||
constructor(private readonly logger: Logger) {}
|
||||
|
||||
async findById(id: string): Promise<MembershipFee | null> {
|
||||
@@ -36,7 +36,7 @@ export class InMemoryMembershipFeeRepository implements IMembershipFeeRepository
|
||||
}
|
||||
}
|
||||
|
||||
export class InMemoryMemberPaymentRepository implements IMemberPaymentRepository {
|
||||
export class InMemoryMemberPaymentRepository implements MemberPaymentRepository {
|
||||
constructor(private readonly logger: Logger) {}
|
||||
|
||||
async findById(id: string): Promise<MemberPayment | null> {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import type { Logger } from '@core/shared/application/Logger';
|
||||
import type { Logger } from '@core/shared/domain/Logger';
|
||||
import type { Payment } from '@core/payments/domain/entities/Payment';
|
||||
import { PaymentType, PaymentStatus, PayerType } from '@core/payments/domain/entities/Payment';
|
||||
import { InMemoryPaymentRepository } from './InMemoryPaymentRepository';
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
* In-Memory Implementation: InMemoryPaymentRepository
|
||||
*/
|
||||
|
||||
import type { Logger } from '@core/shared/application/Logger';
|
||||
import type { IPaymentRepository } from '@core/payments/domain/repositories/IPaymentRepository';
|
||||
import type { Logger } from '@core/shared/domain/Logger';
|
||||
import type { PaymentRepository } from '@core/payments/domain/repositories/PaymentRepository';
|
||||
import type { Payment, PaymentType } from '@core/payments/domain/entities/Payment';
|
||||
|
||||
const payments: Map<string, Payment> = new Map();
|
||||
|
||||
export class InMemoryPaymentRepository implements IPaymentRepository {
|
||||
export class InMemoryPaymentRepository implements PaymentRepository {
|
||||
constructor(private readonly logger: Logger) {}
|
||||
|
||||
async findById(id: string): Promise<Payment | null> {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import type { Logger } from '@core/shared/application/Logger';
|
||||
import type { Logger } from '@core/shared/domain/Logger';
|
||||
import type { Prize } from '@core/payments/domain/entities/Prize';
|
||||
import { PrizeType } from '@core/payments/domain/entities/Prize';
|
||||
import { InMemoryPrizeRepository } from './InMemoryPrizeRepository';
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
* In-Memory Implementation: InMemoryPrizeRepository
|
||||
*/
|
||||
|
||||
import type { Logger } from '@core/shared/application/Logger';
|
||||
import type { IPrizeRepository } from '@core/payments/domain/repositories/IPrizeRepository';
|
||||
import type { Logger } from '@core/shared/domain/Logger';
|
||||
import type { PrizeRepository } from '@core/payments/domain/repositories/PrizeRepository';
|
||||
import type { Prize } from '@core/payments/domain/entities/Prize';
|
||||
|
||||
const prizes: Map<string, Prize> = new Map();
|
||||
|
||||
export class InMemoryPrizeRepository implements IPrizeRepository {
|
||||
export class InMemoryPrizeRepository implements PrizeRepository {
|
||||
constructor(private readonly logger: Logger) {}
|
||||
|
||||
async findById(id: string): Promise<Prize | null> {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import type { Logger } from '@core/shared/application/Logger';
|
||||
import type { Logger } from '@core/shared/domain/Logger';
|
||||
import type { Wallet, Transaction } from '@core/payments/domain/entities/Wallet';
|
||||
import { TransactionType } from '@core/payments/domain/entities/Wallet';
|
||||
import { InMemoryTransactionRepository, InMemoryWalletRepository } from './InMemoryWalletRepository';
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
* In-Memory Implementation: InMemoryWalletRepository
|
||||
*/
|
||||
|
||||
import type { Logger } from '@core/shared/application/Logger';
|
||||
import type { IWalletRepository, ITransactionRepository } from '@core/payments/domain/repositories/IWalletRepository';
|
||||
import type { Logger } from '@core/shared/domain/Logger';
|
||||
import type { WalletRepository, ITransactionRepository } from '@core/payments/domain/repositories/WalletRepository';
|
||||
import type { Wallet, Transaction } from '@core/payments/domain/entities/Wallet';
|
||||
|
||||
const wallets: Map<string, Wallet> = new Map();
|
||||
const transactions: Map<string, Transaction> = new Map();
|
||||
|
||||
export class InMemoryWalletRepository implements IWalletRepository {
|
||||
export class InMemoryWalletRepository implements WalletRepository {
|
||||
constructor(private readonly logger: Logger) {}
|
||||
|
||||
async findById(id: string): Promise<Wallet | null> {
|
||||
@@ -35,7 +35,7 @@ export class InMemoryWalletRepository implements IWalletRepository {
|
||||
}
|
||||
}
|
||||
|
||||
export class InMemoryTransactionRepository implements ITransactionRepository {
|
||||
export class InMemoryTransactionRepository implements TransactionRepository {
|
||||
constructor(private readonly logger: Logger) {}
|
||||
|
||||
async findById(id: string): Promise<Transaction | null> {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { DataSource } from 'typeorm';
|
||||
|
||||
import type { IMemberPaymentRepository, IMembershipFeeRepository } from '@core/payments/domain/repositories/IMembershipFeeRepository';
|
||||
import type { MemberPaymentRepository, IMembershipFeeRepository } from '@core/payments/domain/repositories/MembershipFeeRepository';
|
||||
import type { MemberPayment } from '@core/payments/domain/entities/MemberPayment';
|
||||
import type { MembershipFee } from '@core/payments/domain/entities/MembershipFee';
|
||||
|
||||
@@ -9,7 +9,7 @@ import { PaymentsMembershipFeeOrmEntity } from '../entities/PaymentsMembershipFe
|
||||
import { PaymentsMemberPaymentOrmMapper } from '../mappers/PaymentsMemberPaymentOrmMapper';
|
||||
import { PaymentsMembershipFeeOrmMapper } from '../mappers/PaymentsMembershipFeeOrmMapper';
|
||||
|
||||
export class TypeOrmMembershipFeeRepository implements IMembershipFeeRepository {
|
||||
export class TypeOrmMembershipFeeRepository implements MembershipFeeRepository {
|
||||
constructor(
|
||||
private readonly dataSource: DataSource,
|
||||
private readonly mapper: PaymentsMembershipFeeOrmMapper,
|
||||
@@ -40,7 +40,7 @@ export class TypeOrmMembershipFeeRepository implements IMembershipFeeRepository
|
||||
}
|
||||
}
|
||||
|
||||
export class TypeOrmMemberPaymentRepository implements IMemberPaymentRepository {
|
||||
export class TypeOrmMemberPaymentRepository implements MemberPaymentRepository {
|
||||
constructor(
|
||||
private readonly dataSource: DataSource,
|
||||
private readonly mapper: PaymentsMemberPaymentOrmMapper,
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import type { DataSource } from 'typeorm';
|
||||
|
||||
import type { IPaymentRepository } from '@core/payments/domain/repositories/IPaymentRepository';
|
||||
import type { PaymentRepository } from '@core/payments/domain/repositories/PaymentRepository';
|
||||
import type { Payment, PaymentType } from '@core/payments/domain/entities/Payment';
|
||||
|
||||
import { PaymentsPaymentOrmEntity } from '../entities/PaymentsPaymentOrmEntity';
|
||||
import { PaymentsPaymentOrmMapper } from '../mappers/PaymentsPaymentOrmMapper';
|
||||
|
||||
export class TypeOrmPaymentRepository implements IPaymentRepository {
|
||||
export class TypeOrmPaymentRepository implements PaymentRepository {
|
||||
constructor(
|
||||
private readonly dataSource: DataSource,
|
||||
private readonly mapper: PaymentsPaymentOrmMapper,
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import type { DataSource } from 'typeorm';
|
||||
|
||||
import type { IPrizeRepository } from '@core/payments/domain/repositories/IPrizeRepository';
|
||||
import type { PrizeRepository } from '@core/payments/domain/repositories/PrizeRepository';
|
||||
import type { Prize } from '@core/payments/domain/entities/Prize';
|
||||
|
||||
import { PaymentsPrizeOrmEntity } from '../entities/PaymentsPrizeOrmEntity';
|
||||
import { PaymentsPrizeOrmMapper } from '../mappers/PaymentsPrizeOrmMapper';
|
||||
|
||||
export class TypeOrmPrizeRepository implements IPrizeRepository {
|
||||
export class TypeOrmPrizeRepository implements PrizeRepository {
|
||||
constructor(
|
||||
private readonly dataSource: DataSource,
|
||||
private readonly mapper: PaymentsPrizeOrmMapper,
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import type { DataSource } from 'typeorm';
|
||||
|
||||
import type { ITransactionRepository, IWalletRepository } from '@core/payments/domain/repositories/IWalletRepository';
|
||||
import type { TransactionRepository, IWalletRepository } from '@core/payments/domain/repositories/WalletRepository';
|
||||
import type { Transaction, Wallet } from '@core/payments/domain/entities/Wallet';
|
||||
|
||||
import { PaymentsTransactionOrmEntity } from '../entities/PaymentsTransactionOrmEntity';
|
||||
import { PaymentsWalletOrmEntity } from '../entities/PaymentsWalletOrmEntity';
|
||||
import { PaymentsWalletOrmMapper } from '../mappers/PaymentsWalletOrmMapper';
|
||||
|
||||
export class TypeOrmWalletRepository implements IWalletRepository {
|
||||
export class TypeOrmWalletRepository implements WalletRepository {
|
||||
constructor(
|
||||
private readonly dataSource: DataSource,
|
||||
private readonly mapper: PaymentsWalletOrmMapper,
|
||||
@@ -38,7 +38,7 @@ export class TypeOrmWalletRepository implements IWalletRepository {
|
||||
}
|
||||
}
|
||||
|
||||
export class TypeOrmTransactionRepository implements ITransactionRepository {
|
||||
export class TypeOrmTransactionRepository implements TransactionRepository {
|
||||
constructor(
|
||||
private readonly dataSource: DataSource,
|
||||
private readonly mapper: PaymentsWalletOrmMapper,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { IAchievementRepository } from "@core/identity/application/use-cases/achievement/CreateAchievementUseCase";
|
||||
import { AchievementRepository } from "@core/identity/application/use-cases/achievement/CreateAchievementUseCase";
|
||||
import { Achievement } from "@core/identity/domain/entities/Achievement";
|
||||
|
||||
|
||||
export class InMemoryAchievementRepository implements IAchievementRepository {
|
||||
export class InMemoryAchievementRepository implements AchievementRepository {
|
||||
private readonly achievements: Map<string, Achievement> = new Map();
|
||||
|
||||
async save(achievement: Achievement): Promise<void> {
|
||||
|
||||
@@ -3,7 +3,7 @@ import { InMemoryCarRepository } from './InMemoryCarRepository';
|
||||
import { Car } from '@core/racing/domain/entities/Car';
|
||||
import { CarClass } from '@core/racing/domain/entities/CarClass';
|
||||
import { CarLicense } from '@core/racing/domain/entities/CarLicense';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import type { Logger } from '@core/shared/domain';
|
||||
|
||||
describe('InMemoryCarRepository', () => {
|
||||
let repository: InMemoryCarRepository;
|
||||
|
||||
@@ -9,10 +9,10 @@ import { v4 as uuidv4 } from 'uuid';
|
||||
import { Car } from '@core/racing/domain/entities/Car';
|
||||
import { CarClass } from '@core/racing/domain/entities/CarClass';
|
||||
import { CarLicense } from '@core/racing/domain/entities/CarLicense';
|
||||
import type { ICarRepository } from '@core/racing/domain/repositories/ICarRepository';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import type { CarRepository } from '@core/racing/domain/repositories/CarRepository';
|
||||
import type { Logger } from '@core/shared/domain';
|
||||
|
||||
export class InMemoryCarRepository implements ICarRepository {
|
||||
export class InMemoryCarRepository implements CarRepository {
|
||||
private cars: Map<string, Car>;
|
||||
private readonly logger: Logger;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { vi, describe, it, expect, beforeEach } from 'vitest';
|
||||
import { InMemoryDriverRepository } from './InMemoryDriverRepository';
|
||||
import { Driver } from '@core/racing/domain/entities/Driver';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import type { Logger } from '@core/shared/domain';
|
||||
import { MediaReference } from '@core/domain/media/MediaReference';
|
||||
|
||||
describe('InMemoryDriverRepository', () => {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { IDriverRepository } from '@core/racing/domain/repositories/IDriverRepository';
|
||||
import { DriverRepository } from '@core/racing/domain/repositories/DriverRepository';
|
||||
import { Driver } from '@core/racing/domain/entities/Driver';
|
||||
import { Logger } from '@core/shared/application';
|
||||
import { Logger } from '@core/shared/domain';
|
||||
import { MediaReference } from '@core/domain/media/MediaReference';
|
||||
|
||||
export class InMemoryDriverRepository implements IDriverRepository {
|
||||
export class InMemoryDriverRepository implements DriverRepository {
|
||||
private drivers: Map<string, Driver> = new Map();
|
||||
private iracingIdIndex: Map<string, string> = new Map(); // iracingId -> driverId
|
||||
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
* Stores computed driver statistics for caching and frontend queries.
|
||||
*/
|
||||
|
||||
import type { IDriverStatsRepository } from '@core/racing/domain/repositories/IDriverStatsRepository';
|
||||
import type { DriverStats } from '@core/racing/application/use-cases/IDriverStatsUseCase';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import type { DriverStatsRepository } from '@core/racing/domain/repositories/DriverStatsRepository';
|
||||
import type { DriverStats } from '@core/racing/application/use-cases/DriverStatsUseCase';
|
||||
import type { Logger } from '@core/shared/domain';
|
||||
|
||||
export class InMemoryDriverStatsRepository implements IDriverStatsRepository {
|
||||
export class InMemoryDriverStatsRepository implements DriverStatsRepository {
|
||||
private stats = new Map<string, DriverStats>();
|
||||
|
||||
constructor(private readonly logger: Logger) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { vi, describe, it, expect, beforeEach } from 'vitest';
|
||||
import { InMemoryGameRepository } from './InMemoryGameRepository';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import type { Logger } from '@core/shared/domain';
|
||||
|
||||
describe('InMemoryGameRepository', () => {
|
||||
let repository: InMemoryGameRepository;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { IGameRepository } from '@core/racing/domain/repositories/IGameRepository';
|
||||
import { GameRepository } from '@core/racing/domain/repositories/GameRepository';
|
||||
import { Game } from '@core/racing/domain/entities/Game';
|
||||
import { Logger } from '@core/shared/application';
|
||||
import { Logger } from '@core/shared/domain';
|
||||
|
||||
export class InMemoryGameRepository implements IGameRepository {
|
||||
export class InMemoryGameRepository implements GameRepository {
|
||||
private games: Map<string, Game> = new Map();
|
||||
|
||||
constructor(private readonly logger: Logger) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import type { Logger } from '@core/shared/domain';
|
||||
import { InMemoryLeagueMembershipRepository } from './InMemoryLeagueMembershipRepository';
|
||||
|
||||
describe('InMemoryLeagueMembershipRepository', () => {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { ILeagueMembershipRepository } from '@core/racing/domain/repositories/ILeagueMembershipRepository';
|
||||
import { LeagueMembershipRepository } from '@core/racing/domain/repositories/LeagueMembershipRepository';
|
||||
import { LeagueMembership } from '@core/racing/domain/entities/LeagueMembership';
|
||||
import { JoinRequest } from '@core/racing/domain/entities/JoinRequest';
|
||||
import { Logger } from '@core/shared/application';
|
||||
import { Logger } from '@core/shared/domain';
|
||||
|
||||
export class InMemoryLeagueMembershipRepository implements ILeagueMembershipRepository {
|
||||
export class InMemoryLeagueMembershipRepository implements LeagueMembershipRepository {
|
||||
private memberships: Map<string, LeagueMembership> = new Map(); // Key: `${leagueId}:${driverId}`
|
||||
private joinRequests: Map<string, JoinRequest> = new Map(); // Key: requestId
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { vi, describe, it, expect, beforeEach } from 'vitest';
|
||||
import { InMemoryLeagueRepository } from './InMemoryLeagueRepository';
|
||||
import { League } from '@core/racing/domain/entities/League';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import type { Logger } from '@core/shared/domain';
|
||||
|
||||
describe('InMemoryLeagueRepository', () => {
|
||||
let repository: InMemoryLeagueRepository;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { ILeagueRepository } from '@core/racing/domain/repositories/ILeagueRepository';
|
||||
import { LeagueRepository } from '@core/racing/domain/repositories/LeagueRepository';
|
||||
import { League } from '@core/racing/domain/entities/League';
|
||||
import { Logger } from '@core/shared/application';
|
||||
import { Logger } from '@core/shared/domain';
|
||||
import { MediaReference } from '@core/domain/media/MediaReference';
|
||||
|
||||
export class InMemoryLeagueRepository implements ILeagueRepository {
|
||||
export class InMemoryLeagueRepository implements LeagueRepository {
|
||||
private leagues: Map<string, League> = new Map();
|
||||
private readonly logger: Logger;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { InMemoryLeagueScoringConfigRepository } from './InMemoryLeagueScoringCo
|
||||
import { LeagueScoringConfig, type LeagueScoringConfigProps } from '@core/racing/domain/entities/LeagueScoringConfig';
|
||||
import type { ChampionshipConfig } from '@core/racing/domain/types/ChampionshipConfig';
|
||||
import { PointsTable } from '@core/racing/domain/value-objects/PointsTable';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import type { Logger } from '@core/shared/domain';
|
||||
|
||||
const mockPointsTable = new PointsTable({ 1: 25, 2: 18, 3: 15 });
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { ILeagueScoringConfigRepository } from '@core/racing/domain/repositories/ILeagueScoringConfigRepository';
|
||||
import { LeagueScoringConfigRepository } from '@core/racing/domain/repositories/LeagueScoringConfigRepository';
|
||||
import { LeagueScoringConfig } from '@core/racing/domain/entities/LeagueScoringConfig';
|
||||
import { Logger } from '@core/shared/application';
|
||||
import { Logger } from '@core/shared/domain';
|
||||
|
||||
export class InMemoryLeagueScoringConfigRepository implements ILeagueScoringConfigRepository {
|
||||
export class InMemoryLeagueScoringConfigRepository implements LeagueScoringConfigRepository {
|
||||
private configs: Map<string, LeagueScoringConfig> = new Map(); // Key: seasonId
|
||||
|
||||
constructor(private readonly logger: Logger) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { vi, describe, it, expect, beforeEach } from 'vitest';
|
||||
import { InMemoryLeagueStandingsRepository } from './InMemoryLeagueStandingsRepository';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import type { RawStanding } from '@core/league/application/ports/ILeagueStandingsRepository';
|
||||
import type { Logger } from '@core/shared/domain';
|
||||
import type { RawStanding } from '@core/league/application/ports/LeagueStandingsRepository';
|
||||
|
||||
describe('InMemoryLeagueStandingsRepository', () => {
|
||||
let repository: InMemoryLeagueStandingsRepository;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { ILeagueStandingsRepository, RawStanding } from '@core/league/application/ports/ILeagueStandingsRepository';
|
||||
import { Logger } from '@core/shared/application';
|
||||
import { LeagueStandingsRepository, RawStanding } from '@core/league/application/ports/LeagueStandingsRepository';
|
||||
import { Logger } from '@core/shared/domain';
|
||||
|
||||
export class InMemoryLeagueStandingsRepository implements ILeagueStandingsRepository {
|
||||
export class InMemoryLeagueStandingsRepository implements LeagueStandingsRepository {
|
||||
private standings: Map<string, RawStanding[]> = new Map(); // Key: leagueId
|
||||
|
||||
constructor(private readonly logger: Logger) {
|
||||
|
||||
@@ -2,7 +2,7 @@ import { vi, describe, it, expect, beforeEach } from 'vitest';
|
||||
import { InMemoryLeagueWalletRepository } from './InMemoryLeagueWalletRepository';
|
||||
import { LeagueWallet } from '@core/racing/domain/entities/league-wallet/LeagueWallet';
|
||||
import { Money } from '@core/racing/domain/value-objects/Money';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import type { Logger } from '@core/shared/domain';
|
||||
|
||||
describe('InMemoryLeagueWalletRepository', () => {
|
||||
let repository: InMemoryLeagueWalletRepository;
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
*/
|
||||
|
||||
import { LeagueWallet } from '@core/racing/domain/entities/league-wallet/LeagueWallet';
|
||||
import type { ILeagueWalletRepository } from '@core/racing/domain/repositories/ILeagueWalletRepository';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import type { LeagueWalletRepository } from '@core/racing/domain/repositories/LeagueWalletRepository';
|
||||
import type { Logger } from '@core/shared/domain';
|
||||
|
||||
export class InMemoryLeagueWalletRepository implements ILeagueWalletRepository {
|
||||
export class InMemoryLeagueWalletRepository implements LeagueWalletRepository {
|
||||
private wallets: Map<string, LeagueWallet> = new Map();
|
||||
private readonly logger: Logger;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { InMemoryLiveryRepository } from './InMemoryLiveryRepository';
|
||||
import { DriverLivery } from '@core/racing/domain/entities/DriverLivery';
|
||||
import { LiveryTemplate } from '@core/racing/domain/entities/LiveryTemplate';
|
||||
import { LiveryDecal } from '@core/racing/domain/value-objects/LiveryDecal';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import type { Logger } from '@core/shared/domain';
|
||||
|
||||
describe('InMemoryLiveryRepository', () => {
|
||||
let repository: InMemoryLiveryRepository;
|
||||
|
||||
@@ -6,10 +6,10 @@
|
||||
|
||||
import type { DriverLivery } from '../../../../core/racing/domain/entities/DriverLivery';
|
||||
import type { LiveryTemplate } from '../../../../core/racing/domain/entities/LiveryTemplate';
|
||||
import type { ILiveryRepository } from '../../../../core/racing/domain/repositories/ILiveryRepository';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import type { LiveryRepository } from '../../../../core/racing/domain/repositories/LiveryRepository';
|
||||
import type { Logger } from '@core/shared/domain';
|
||||
|
||||
export class InMemoryLiveryRepository implements ILiveryRepository {
|
||||
export class InMemoryLiveryRepository implements LiveryRepository {
|
||||
private driverLiveries: Map<string, DriverLivery> = new Map();
|
||||
private templates: Map<string, LiveryTemplate> = new Map();
|
||||
private readonly logger: Logger;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { vi, describe, it, expect, beforeEach } from 'vitest';
|
||||
import { InMemoryPenaltyRepository } from './InMemoryPenaltyRepository';
|
||||
import { Penalty } from '@core/racing/domain/entities/penalty/Penalty';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import type { Logger } from '@core/shared/domain';
|
||||
|
||||
describe('InMemoryPenaltyRepository', () => {
|
||||
let repository: InMemoryPenaltyRepository;
|
||||
|
||||
@@ -5,10 +5,10 @@
|
||||
*/
|
||||
|
||||
import type { Penalty } from '@core/racing/domain/entities/penalty/Penalty';
|
||||
import type { IPenaltyRepository } from '@core/racing/domain/repositories/IPenaltyRepository';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import type { PenaltyRepository } from '@core/racing/domain/repositories/PenaltyRepository';
|
||||
import type { Logger } from '@core/shared/domain';
|
||||
|
||||
export class InMemoryPenaltyRepository implements IPenaltyRepository {
|
||||
export class InMemoryPenaltyRepository implements PenaltyRepository {
|
||||
private penalties: Map<string, Penalty> = new Map();
|
||||
private readonly logger: Logger;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { vi, describe, it, expect, beforeEach } from 'vitest';
|
||||
import { InMemoryProtestRepository } from './InMemoryProtestRepository';
|
||||
import { Protest } from '@core/racing/domain/entities/Protest';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import type { Logger } from '@core/shared/domain';
|
||||
|
||||
describe('InMemoryProtestRepository', () => {
|
||||
let repository: InMemoryProtestRepository;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { IProtestRepository } from '@core/racing/domain/repositories/IProtestRepository';
|
||||
import { ProtestRepository } from '@core/racing/domain/repositories/ProtestRepository';
|
||||
import { Protest } from '@core/racing/domain/entities/Protest';
|
||||
import { Logger } from '@core/shared/application';
|
||||
import { Logger } from '@core/shared/domain';
|
||||
|
||||
export class InMemoryProtestRepository implements IProtestRepository {
|
||||
export class InMemoryProtestRepository implements ProtestRepository {
|
||||
private protests: Map<string, Protest> = new Map();
|
||||
|
||||
constructor(private readonly logger: Logger) {
|
||||
|
||||
@@ -3,7 +3,7 @@ import { InMemoryRaceEventRepository } from './InMemoryRaceEventRepository';
|
||||
import { RaceEvent } from '@core/racing/domain/entities/RaceEvent';
|
||||
import { Session } from '@core/racing/domain/entities/Session';
|
||||
import { SessionType } from '@core/racing/domain/value-objects/SessionType';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import type { Logger } from '@core/shared/domain';
|
||||
|
||||
describe('InMemoryRaceEventRepository', () => {
|
||||
let repository: InMemoryRaceEventRepository;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
/**
|
||||
* In-memory implementation of IRaceEventRepository for development/testing.
|
||||
*/
|
||||
import type { IRaceEventRepository } from '@core/racing/domain/repositories/IRaceEventRepository';
|
||||
import type { RaceEventRepository } from '@core/racing/domain/repositories/RaceEventRepository';
|
||||
import type { RaceEvent } from '@core/racing/domain/entities/RaceEvent';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import type { Logger } from '@core/shared/domain';
|
||||
|
||||
export class InMemoryRaceEventRepository implements IRaceEventRepository {
|
||||
export class InMemoryRaceEventRepository implements RaceEventRepository {
|
||||
private raceEvents: Map<string, RaceEvent> = new Map();
|
||||
private readonly logger: Logger;
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user