website refactor
This commit is contained in:
@@ -1,13 +0,0 @@
|
||||
/**
|
||||
* DTOs Index
|
||||
*
|
||||
* Export all DTO types
|
||||
*/
|
||||
|
||||
export type { RatingSummaryDto, PlatformRatingDimension, ExternalGameRating, ExternalGameRatings } from './RatingSummaryDto';
|
||||
export type { LedgerEntryDto, LedgerFilter, PaginatedLedgerResult } from './LedgerEntryDto';
|
||||
export type { EligibilityFilterDto, EligibilityCondition, ParsedEligibilityFilter } from './EligibilityFilterDto';
|
||||
export type { EvaluationResultDto, EvaluationReason } from './EvaluationResultDto';
|
||||
|
||||
// Existing DTOs
|
||||
export type { UserRatingDto, RatingDimensionDto } from './UserRatingDto';
|
||||
@@ -19,7 +19,7 @@ export interface RaceResultsData {
|
||||
results: RaceResultData[];
|
||||
}
|
||||
|
||||
export interface IRaceResultsProvider {
|
||||
export interface RaceResultsProvider {
|
||||
/**
|
||||
* Get race results by race ID
|
||||
* Returns null if race not found or no results
|
||||
@@ -9,8 +9,8 @@ import { GameKey } from '../../domain/value-objects/GameKey';
|
||||
import { UserRating } from '../../domain/value-objects/UserRating';
|
||||
import { UserId } from '../../domain/value-objects/UserId';
|
||||
import { GetLeagueEligibilityPreviewQuery, GetLeagueEligibilityPreviewQueryHandler } from './GetLeagueEligibilityPreviewQuery';
|
||||
import { IUserRatingRepository } from '../../domain/repositories/IUserRatingRepository';
|
||||
import { IExternalGameRatingRepository } from '../../domain/repositories/IExternalGameRatingRepository';
|
||||
import { UserRatingRepository } from '../../domain/repositories/UserRatingRepository';
|
||||
import { ExternalGameRatingRepository } from '../../domain/repositories/ExternalGameRatingRepository';
|
||||
|
||||
describe('GetLeagueEligibilityPreviewQuery', () => {
|
||||
let mockUserRatingRepo: IUserRatingRepository;
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
import { EvaluationResultDto } from '../dtos/EvaluationResultDto';
|
||||
import { EligibilityFilterDto } from '../dtos/EligibilityFilterDto';
|
||||
import { EligibilityEvaluator, RatingData } from '../../domain/services/EligibilityEvaluator';
|
||||
import { IUserRatingRepository } from '../../domain/repositories/IUserRatingRepository';
|
||||
import { IExternalGameRatingRepository } from '../../domain/repositories/IExternalGameRatingRepository';
|
||||
import { UserRatingRepository } from '../../domain/repositories/UserRatingRepository';
|
||||
import { ExternalGameRatingRepository } from '../../domain/repositories/ExternalGameRatingRepository';
|
||||
|
||||
export interface GetLeagueEligibilityPreviewQuery {
|
||||
userId: string;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
import { LedgerEntryDto, LedgerFilter, PaginatedLedgerResult } from '../dtos/LedgerEntryDto';
|
||||
import { IRatingEventRepository, PaginatedQueryOptions, RatingEventFilter } from '../../domain/repositories/IRatingEventRepository';
|
||||
import { RatingEventRepository, PaginatedQueryOptions, RatingEventFilter } from '../../domain/repositories/RatingEventRepository';
|
||||
|
||||
export interface GetUserRatingLedgerQuery {
|
||||
userId: string;
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
*/
|
||||
|
||||
import { RatingSummaryDto } from '../dtos/RatingSummaryDto';
|
||||
import { IUserRatingRepository } from '../../domain/repositories/IUserRatingRepository';
|
||||
import { IExternalGameRatingRepository } from '../../domain/repositories/IExternalGameRatingRepository';
|
||||
import { IRatingEventRepository } from '../../domain/repositories/IRatingEventRepository';
|
||||
import { UserRatingRepository } from '../../domain/repositories/UserRatingRepository';
|
||||
import { ExternalGameRatingRepository } from '../../domain/repositories/ExternalGameRatingRepository';
|
||||
import { RatingEventRepository } from '../../domain/repositories/RatingEventRepository';
|
||||
|
||||
export interface GetUserRatingsSummaryQuery {
|
||||
userId: string;
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
/**
|
||||
* Queries Index
|
||||
*
|
||||
* Export all query handlers and related types
|
||||
*/
|
||||
|
||||
// GetUserRatingsSummaryQuery
|
||||
export type { GetUserRatingsSummaryQuery } from './GetUserRatingsSummaryQuery';
|
||||
export { GetUserRatingsSummaryQueryHandler } from './GetUserRatingsSummaryQuery';
|
||||
|
||||
// GetUserRatingLedgerQuery
|
||||
export type { GetUserRatingLedgerQuery } from './GetUserRatingLedgerQuery';
|
||||
export { GetUserRatingLedgerQueryHandler } from './GetUserRatingLedgerQuery';
|
||||
|
||||
// GetLeagueEligibilityPreviewQuery
|
||||
export type { GetLeagueEligibilityPreviewQuery } from './GetLeagueEligibilityPreviewQuery';
|
||||
export { GetLeagueEligibilityPreviewQueryHandler } from './GetLeagueEligibilityPreviewQuery';
|
||||
@@ -1,8 +1,8 @@
|
||||
import { describe, expect, it, vi, beforeEach } from 'vitest';
|
||||
|
||||
import { AppendRatingEventsUseCase, AppendRatingEventsInput } from './AppendRatingEventsUseCase';
|
||||
import { IRatingEventRepository } from '../../domain/repositories/IRatingEventRepository';
|
||||
import { IUserRatingRepository } from '../../domain/repositories/IUserRatingRepository';
|
||||
import { RatingEventRepository } from '../../domain/repositories/RatingEventRepository';
|
||||
import { UserRatingRepository } from '../../domain/repositories/UserRatingRepository';
|
||||
import { RatingEvent } from '../../domain/entities/RatingEvent';
|
||||
import { UserRating } from '../../domain/value-objects/UserRating';
|
||||
import { RatingEventId } from '../../domain/value-objects/RatingEventId';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { IRatingEventRepository } from '../../domain/repositories/IRatingEventRepository';
|
||||
import { IUserRatingRepository } from '../../domain/repositories/IUserRatingRepository';
|
||||
import { RatingEventRepository } from '../../domain/repositories/RatingEventRepository';
|
||||
import { UserRatingRepository } from '../../domain/repositories/UserRatingRepository';
|
||||
import { RatingEventFactory } from '../../domain/services/RatingEventFactory';
|
||||
import { RatingSnapshotCalculator } from '../../domain/services/RatingSnapshotCalculator';
|
||||
import { RatingEvent } from '../../domain/entities/RatingEvent';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { IAdminVoteSessionRepository } from '../../domain/repositories/IAdminVoteSessionRepository';
|
||||
import { AdminVoteSessionRepository } from '../../domain/repositories/AdminVoteSessionRepository';
|
||||
import { CastAdminVoteInput, CastAdminVoteOutput } from '../dtos/AdminVoteSessionDto';
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { IAdminVoteSessionRepository } from '../../domain/repositories/IAdminVoteSessionRepository';
|
||||
import { IRatingEventRepository } from '../../domain/repositories/IRatingEventRepository';
|
||||
import { IUserRatingRepository } from '../../domain/repositories/IUserRatingRepository';
|
||||
import { AdminVoteSessionRepository } from '../../domain/repositories/AdminVoteSessionRepository';
|
||||
import { RatingEventRepository } from '../../domain/repositories/RatingEventRepository';
|
||||
import { UserRatingRepository } from '../../domain/repositories/UserRatingRepository';
|
||||
import { AdminTrustRatingCalculator } from '../../domain/services/AdminTrustRatingCalculator';
|
||||
import { RatingSnapshotCalculator } from '../../domain/services/RatingSnapshotCalculator';
|
||||
import { RatingEventFactory } from '../../domain/services/RatingEventFactory';
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { describe, it, expect, vi, type Mock } from 'vitest';
|
||||
import { ForgotPasswordUseCase } from './ForgotPasswordUseCase';
|
||||
import type { IAuthRepository } from '../../domain/repositories/IAuthRepository';
|
||||
import type { IMagicLinkRepository } from '../../domain/repositories/IMagicLinkRepository';
|
||||
import type { IMagicLinkNotificationPort } from '../../domain/ports/IMagicLinkNotificationPort';
|
||||
import type { AuthRepository } from '../../domain/repositories/AuthRepository';
|
||||
import type { MagicLinkRepository } from '../../domain/repositories/MagicLinkRepository';
|
||||
import type { MagicLinkNotificationPort } from '../../domain/ports/MagicLinkNotificationPort';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import { Result } from '@core/shared/application/Result';
|
||||
import { Result } from '@core/shared/domain/Result';
|
||||
import { User } from '../../domain/entities/User';
|
||||
import { UserId } from '../../domain/value-objects/UserId';
|
||||
import { PasswordHash } from '../../domain/value-objects/PasswordHash';
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { EmailAddress } from '../../domain/value-objects/EmailAddress';
|
||||
import { IAuthRepository } from '../../domain/repositories/IAuthRepository';
|
||||
import { IMagicLinkRepository } from '../../domain/repositories/IMagicLinkRepository';
|
||||
import { IMagicLinkNotificationPort } from '../../domain/ports/IMagicLinkNotificationPort';
|
||||
import { Result } from '@core/shared/application/Result';
|
||||
import { AuthRepository } from '../../domain/repositories/AuthRepository';
|
||||
import { MagicLinkRepository } from '../../domain/repositories/MagicLinkRepository';
|
||||
import { MagicLinkNotificationPort } from '../../domain/ports/MagicLinkNotificationPort';
|
||||
import { Result } from '@core/shared/domain/Result';
|
||||
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
|
||||
import type { Logger, UseCase } from '@core/shared/application';
|
||||
import { randomBytes } from 'crypto';
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { vi, type Mock } from 'vitest';
|
||||
import { GetCurrentSessionUseCase } from './GetCurrentSessionUseCase';
|
||||
import { User } from '../../domain/entities/User';
|
||||
import { IUserRepository, StoredUser } from '../../domain/repositories/IUserRepository';
|
||||
import { UserRepository, StoredUser } from '../../domain/repositories/UserRepository';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import { Result } from '@core/shared/application/Result';
|
||||
import { Result } from '@core/shared/domain/Result';
|
||||
|
||||
describe('GetCurrentSessionUseCase', () => {
|
||||
let useCase: GetCurrentSessionUseCase;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { User } from '../../domain/entities/User';
|
||||
import { IUserRepository } from '../../domain/repositories/IUserRepository';
|
||||
import { Result } from '@core/shared/application/Result';
|
||||
import { UserRepository } from '../../domain/repositories/UserRepository';
|
||||
import { Result } from '@core/shared/domain/Result';
|
||||
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import { describe, it, expect, vi, type Mock } from 'vitest';
|
||||
import { GetCurrentUserSessionUseCase } from './GetCurrentUserSessionUseCase';
|
||||
import type { AuthSession, IdentitySessionPort } from '../ports/IdentitySessionPort';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import { Result } from '@core/shared/application/Result';
|
||||
import { Result } from '@core/shared/domain/Result';
|
||||
|
||||
describe('GetCurrentUserSessionUseCase', () => {
|
||||
let sessionPort: {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { AuthSession, IdentitySessionPort } from '../ports/IdentitySessionPort';
|
||||
import { Result } from '@core/shared/application/Result';
|
||||
import { Result } from '@core/shared/domain/Result';
|
||||
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { describe, it, expect, vi, type Mock } from 'vitest';
|
||||
import { GetUserUseCase } from './GetUserUseCase';
|
||||
import type { IUserRepository } from '../../domain/repositories/IUserRepository';
|
||||
import type { UserRepository } from '../../domain/repositories/UserRepository';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import { Result } from '@core/shared/application/Result';
|
||||
import { Result } from '@core/shared/domain/Result';
|
||||
import { User } from '../../domain/entities/User';
|
||||
import { UserId } from '../../domain/value-objects/UserId';
|
||||
import { PasswordHash } from '../../domain/value-objects/PasswordHash';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { User } from '../../domain/entities/User';
|
||||
import { IUserRepository } from '../../domain/repositories/IUserRepository';
|
||||
import { Result } from '@core/shared/application/Result';
|
||||
import { UserRepository } from '../../domain/repositories/UserRepository';
|
||||
import { Result } from '@core/shared/domain/Result';
|
||||
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
|
||||
import type { Logger, UseCase } from '@core/shared/application';
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { HandleAuthCallbackUseCase } from './HandleAuthCallbackUseCase';
|
||||
import type { IdentityProviderPort } from '../ports/IdentityProviderPort';
|
||||
import type { IdentitySessionPort } from '../ports/IdentitySessionPort';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import { Result } from '@core/shared/application/Result';
|
||||
import { Result } from '@core/shared/domain/Result';
|
||||
|
||||
describe('HandleAuthCallbackUseCase', () => {
|
||||
let provider: {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { AuthCallbackCommand, AuthenticatedUser, IdentityProviderPort } from '../ports/IdentityProviderPort';
|
||||
import type { AuthSession, IdentitySessionPort } from '../ports/IdentitySessionPort';
|
||||
import { Result } from '@core/shared/application/Result';
|
||||
import { Result } from '@core/shared/domain/Result';
|
||||
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { describe, it, expect, vi, type Mock } from 'vitest';
|
||||
import { LoginUseCase } from './LoginUseCase';
|
||||
import type { IAuthRepository } from '../../domain/repositories/IAuthRepository';
|
||||
import type { IPasswordHashingService } from '../../domain/services/PasswordHashingService';
|
||||
import type { AuthRepository } from '../../domain/repositories/AuthRepository';
|
||||
import type { PasswordHashingService } from '../../domain/services/PasswordHashingService';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import { Result } from '@core/shared/application/Result';
|
||||
import { Result } from '@core/shared/domain/Result';
|
||||
import { User } from '../../domain/entities/User';
|
||||
import { UserId } from '../../domain/value-objects/UserId';
|
||||
import { PasswordHash } from '../../domain/value-objects/PasswordHash';
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { EmailAddress } from '../../domain/value-objects/EmailAddress';
|
||||
import { User } from '../../domain/entities/User';
|
||||
import { IAuthRepository } from '../../domain/repositories/IAuthRepository';
|
||||
import { IPasswordHashingService } from '../../domain/services/PasswordHashingService';
|
||||
import { Result } from '@core/shared/application/Result';
|
||||
import { AuthRepository } from '../../domain/repositories/AuthRepository';
|
||||
import { PasswordHashingService } from '../../domain/services/PasswordHashingService';
|
||||
import { Result } from '@core/shared/domain/Result';
|
||||
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
|
||||
import type { Logger, UseCase } from '@core/shared/application';
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { describe, it, expect, vi, type Mock, beforeEach } from 'vitest';
|
||||
import { LoginWithEmailUseCase } from './LoginWithEmailUseCase';
|
||||
import type { IUserRepository } from '../../domain/repositories/IUserRepository';
|
||||
import type { UserRepository } from '../../domain/repositories/UserRepository';
|
||||
import type { IdentitySessionPort } from '../ports/IdentitySessionPort';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
|
||||
|
||||
@@ -4,9 +4,9 @@
|
||||
* Authenticates a user with email and password.
|
||||
*/
|
||||
|
||||
import type { IUserRepository } from '../../domain/repositories/IUserRepository';
|
||||
import type { UserRepository } from '../../domain/repositories/UserRepository';
|
||||
import type { IdentitySessionPort } from '../ports/IdentitySessionPort';
|
||||
import { Result } from '@core/shared/application/Result';
|
||||
import { Result } from '@core/shared/domain/Result';
|
||||
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import { PasswordHash } from '@core/identity/domain/value-objects/PasswordHash';
|
||||
|
||||
@@ -2,7 +2,7 @@ import { describe, it, expect, vi, type Mock } from 'vitest';
|
||||
import { LogoutUseCase } from './LogoutUseCase';
|
||||
import type { IdentitySessionPort } from '../ports/IdentitySessionPort';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import { Result } from '@core/shared/application/Result';
|
||||
import { Result } from '@core/shared/domain/Result';
|
||||
|
||||
describe('LogoutUseCase', () => {
|
||||
let sessionPort: {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { IdentitySessionPort } from '../ports/IdentitySessionPort';
|
||||
import { Result } from '@core/shared/application/Result';
|
||||
import { Result } from '@core/shared/domain/Result';
|
||||
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
|
||||
import type { Logger, UseCase } from '@core/shared/application';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { IAdminVoteSessionRepository } from '../../domain/repositories/IAdminVoteSessionRepository';
|
||||
import { AdminVoteSessionRepository } from '../../domain/repositories/AdminVoteSessionRepository';
|
||||
import { AdminVoteSession } from '../../domain/entities/AdminVoteSession';
|
||||
import { OpenAdminVoteSessionInput, OpenAdminVoteSessionOutput } from '../dtos/AdminVoteSessionDto';
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { describe, expect, it, vi, beforeEach } from 'vitest';
|
||||
|
||||
import { RecomputeUserRatingSnapshotUseCase } from './RecomputeUserRatingSnapshotUseCase';
|
||||
import { IRatingEventRepository } from '../../domain/repositories/IRatingEventRepository';
|
||||
import { IUserRatingRepository } from '../../domain/repositories/IUserRatingRepository';
|
||||
import { RatingEventRepository } from '../../domain/repositories/RatingEventRepository';
|
||||
import { UserRatingRepository } from '../../domain/repositories/UserRatingRepository';
|
||||
import { UserRating } from '../../domain/value-objects/UserRating';
|
||||
import { RatingEvent } from '../../domain/entities/RatingEvent';
|
||||
import { RatingEventId } from '../../domain/value-objects/RatingEventId';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { IRatingEventRepository } from '../../domain/repositories/IRatingEventRepository';
|
||||
import { IUserRatingRepository } from '../../domain/repositories/IUserRatingRepository';
|
||||
import { RatingEventRepository } from '../../domain/repositories/RatingEventRepository';
|
||||
import { UserRatingRepository } from '../../domain/repositories/UserRatingRepository';
|
||||
import { RatingSnapshotCalculator } from '../../domain/services/RatingSnapshotCalculator';
|
||||
import { UserRatingDto } from '../dtos/UserRatingDto';
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { RecordRaceRatingEventsUseCase } from './RecordRaceRatingEventsUseCase';
|
||||
import { IRaceResultsProvider, RaceResultsData } from '../ports/IRaceResultsProvider';
|
||||
import { IRatingEventRepository } from '../../domain/repositories/IRatingEventRepository';
|
||||
import { IUserRatingRepository } from '../../domain/repositories/IUserRatingRepository';
|
||||
import { RaceResultsProvider, RaceResultsData } from '../ports/RaceResultsProvider';
|
||||
import { RatingEventRepository } from '../../domain/repositories/RatingEventRepository';
|
||||
import { UserRatingRepository } from '../../domain/repositories/UserRatingRepository';
|
||||
import { AppendRatingEventsUseCase } from './AppendRatingEventsUseCase';
|
||||
import { UserRating } from '../../domain/value-objects/UserRating';
|
||||
import { RatingEvent } from '../../domain/entities/RatingEvent';
|
||||
@@ -10,7 +10,7 @@ import { RatingDimensionKey } from '../../domain/value-objects/RatingDimensionKe
|
||||
import { RatingDelta } from '../../domain/value-objects/RatingDelta';
|
||||
|
||||
// In-memory implementations for integration testing
|
||||
class InMemoryRaceResultsProvider implements IRaceResultsProvider {
|
||||
class InMemoryRaceResultsProvider implements RaceResultsProvider {
|
||||
private results: Map<string, RaceResultsData> = new Map();
|
||||
|
||||
async getRaceResults(raceId: string): Promise<RaceResultsData | null> {
|
||||
@@ -27,7 +27,7 @@ class InMemoryRaceResultsProvider implements IRaceResultsProvider {
|
||||
}
|
||||
}
|
||||
|
||||
class InMemoryRatingEventRepository implements IRatingEventRepository {
|
||||
class InMemoryRatingEventRepository implements RatingEventRepository {
|
||||
private events: Map<string, RatingEvent[]> = new Map();
|
||||
|
||||
async save(event: RatingEvent): Promise<RatingEvent> {
|
||||
@@ -52,7 +52,7 @@ class InMemoryRatingEventRepository implements IRatingEventRepository {
|
||||
return this.events.get(userId) || [];
|
||||
}
|
||||
|
||||
async findEventsPaginated(userId: string, options?: import('@core/identity/domain/repositories/IRatingEventRepository').PaginatedQueryOptions): Promise<import('@core/identity/domain/repositories/IRatingEventRepository').PaginatedResult<RatingEvent>> {
|
||||
async findEventsPaginated(userId: string, options?: import('@core/identity/domain/repositories/RatingEventRepository').PaginatedQueryOptions): Promise<import('@core/identity/domain/repositories/RatingEventRepository').PaginatedResult<RatingEvent>> {
|
||||
const allEvents = await this.findByUserId(userId);
|
||||
|
||||
// Apply filters
|
||||
@@ -86,7 +86,7 @@ class InMemoryRatingEventRepository implements IRatingEventRepository {
|
||||
const hasMore = offset + limit < total;
|
||||
const nextOffset = hasMore ? offset + limit : undefined;
|
||||
|
||||
const result: import('@core/identity/domain/repositories/IRatingEventRepository').PaginatedResult<RatingEvent> = {
|
||||
const result: import('@core/identity/domain/repositories/RatingEventRepository').PaginatedResult<RatingEvent> = {
|
||||
items,
|
||||
total,
|
||||
limit,
|
||||
@@ -111,7 +111,7 @@ class InMemoryRatingEventRepository implements IRatingEventRepository {
|
||||
}
|
||||
}
|
||||
|
||||
class InMemoryUserRatingRepository implements IUserRatingRepository {
|
||||
class InMemoryUserRatingRepository implements UserRatingRepository {
|
||||
private ratings: Map<string, UserRating> = new Map();
|
||||
|
||||
async findByUserId(userId: string): Promise<UserRating | null> {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { RecordRaceRatingEventsUseCase } from './RecordRaceRatingEventsUseCase';
|
||||
import { IRaceResultsProvider, RaceResultsData } from '../ports/IRaceResultsProvider';
|
||||
import { IRatingEventRepository } from '../../domain/repositories/IRatingEventRepository';
|
||||
import { IUserRatingRepository } from '../../domain/repositories/IUserRatingRepository';
|
||||
import { RaceResultsProvider, RaceResultsData } from '../ports/RaceResultsProvider';
|
||||
import { RatingEventRepository } from '../../domain/repositories/RatingEventRepository';
|
||||
import { UserRatingRepository } from '../../domain/repositories/UserRatingRepository';
|
||||
import { AppendRatingEventsUseCase } from './AppendRatingEventsUseCase';
|
||||
import { UserRating } from '../../domain/value-objects/UserRating';
|
||||
import { RatingEvent } from '../../domain/entities/RatingEvent';
|
||||
@@ -10,7 +10,7 @@ import { RatingDimensionKey } from '../../domain/value-objects/RatingDimensionKe
|
||||
import { RatingDelta } from '../../domain/value-objects/RatingDelta';
|
||||
|
||||
// Mock implementations
|
||||
class MockRaceResultsProvider implements IRaceResultsProvider {
|
||||
class MockRaceResultsProvider implements RaceResultsProvider {
|
||||
private results: RaceResultsData | null = null;
|
||||
|
||||
setResults(results: RaceResultsData | null) {
|
||||
@@ -26,7 +26,7 @@ class MockRaceResultsProvider implements IRaceResultsProvider {
|
||||
}
|
||||
}
|
||||
|
||||
class MockRatingEventRepository implements IRatingEventRepository {
|
||||
class MockRatingEventRepository implements RatingEventRepository {
|
||||
private events: RatingEvent[] = [];
|
||||
|
||||
async save(event: RatingEvent): Promise<RatingEvent> {
|
||||
@@ -46,7 +46,7 @@ class MockRatingEventRepository implements IRatingEventRepository {
|
||||
return this.events.filter(e => e.userId === userId);
|
||||
}
|
||||
|
||||
async findEventsPaginated(userId: string, options?: import('@core/identity/domain/repositories/IRatingEventRepository').PaginatedQueryOptions): Promise<import('@core/identity/domain/repositories/IRatingEventRepository').PaginatedResult<RatingEvent>> {
|
||||
async findEventsPaginated(userId: string, options?: import('@core/identity/domain/repositories/RatingEventRepository').PaginatedQueryOptions): Promise<import('@core/identity/domain/repositories/RatingEventRepository').PaginatedResult<RatingEvent>> {
|
||||
const allEvents = await this.findByUserId(userId);
|
||||
|
||||
// Apply filters
|
||||
@@ -80,7 +80,7 @@ class MockRatingEventRepository implements IRatingEventRepository {
|
||||
const hasMore = offset + limit < total;
|
||||
const nextOffset = hasMore ? offset + limit : undefined;
|
||||
|
||||
const result: import('@core/identity/domain/repositories/IRatingEventRepository').PaginatedResult<RatingEvent> = {
|
||||
const result: import('@core/identity/domain/repositories/RatingEventRepository').PaginatedResult<RatingEvent> = {
|
||||
items,
|
||||
total,
|
||||
limit,
|
||||
@@ -96,7 +96,7 @@ class MockRatingEventRepository implements IRatingEventRepository {
|
||||
}
|
||||
}
|
||||
|
||||
class MockUserRatingRepository implements IUserRatingRepository {
|
||||
class MockUserRatingRepository implements UserRatingRepository {
|
||||
private ratings: Map<string, UserRating> = new Map();
|
||||
|
||||
async findByUserId(userId: string): Promise<UserRating | null> {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { IRaceResultsProvider } from '../ports/IRaceResultsProvider';
|
||||
import { IRatingEventRepository } from '../../domain/repositories/IRatingEventRepository';
|
||||
import { IUserRatingRepository } from '../../domain/repositories/IUserRatingRepository';
|
||||
import { RaceResultsProvider } from '../ports/RaceResultsProvider';
|
||||
import { RatingEventRepository } from '../../domain/repositories/RatingEventRepository';
|
||||
import { UserRatingRepository } from '../../domain/repositories/UserRatingRepository';
|
||||
import { RatingEventFactory } from '../../domain/services/RatingEventFactory';
|
||||
import { DrivingRatingCalculator } from '../../domain/services/DrivingRatingCalculator';
|
||||
import { RatingSnapshotCalculator } from '../../domain/services/RatingSnapshotCalculator';
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { describe, it, expect, vi, type Mock } from 'vitest';
|
||||
import { ResetPasswordUseCase } from './ResetPasswordUseCase';
|
||||
import type { IAuthRepository } from '../../domain/repositories/IAuthRepository';
|
||||
import type { IMagicLinkRepository } from '../../domain/repositories/IMagicLinkRepository';
|
||||
import type { IPasswordHashingService } from '../../domain/services/PasswordHashingService';
|
||||
import type { AuthRepository } from '../../domain/repositories/AuthRepository';
|
||||
import type { MagicLinkRepository } from '../../domain/repositories/MagicLinkRepository';
|
||||
import type { PasswordHashingService } from '../../domain/services/PasswordHashingService';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import { Result } from '@core/shared/application/Result';
|
||||
import { Result } from '@core/shared/domain/Result';
|
||||
import { User } from '../../domain/entities/User';
|
||||
import { UserId } from '../../domain/value-objects/UserId';
|
||||
import { PasswordHash } from '../../domain/value-objects/PasswordHash';
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { IAuthRepository } from '../../domain/repositories/IAuthRepository';
|
||||
import { IMagicLinkRepository } from '../../domain/repositories/IMagicLinkRepository';
|
||||
import { IPasswordHashingService } from '../../domain/services/PasswordHashingService';
|
||||
import { AuthRepository } from '../../domain/repositories/AuthRepository';
|
||||
import { MagicLinkRepository } from '../../domain/repositories/MagicLinkRepository';
|
||||
import { PasswordHashingService } from '../../domain/services/PasswordHashingService';
|
||||
import { EmailAddress } from '../../domain/value-objects/EmailAddress';
|
||||
import { PasswordHash } from '../../domain/value-objects/PasswordHash';
|
||||
import { Result } from '@core/shared/application/Result';
|
||||
import { Result } from '@core/shared/domain/Result';
|
||||
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
|
||||
import type { Logger, UseCase } from '@core/shared/application';
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { describe, it, expect, vi, type Mock } from 'vitest';
|
||||
import { SignupSponsorUseCase } from './SignupSponsorUseCase';
|
||||
import type { IAuthRepository } from '../../domain/repositories/IAuthRepository';
|
||||
import type { ICompanyRepository } from '../../domain/repositories/ICompanyRepository';
|
||||
import type { IPasswordHashingService } from '../../domain/services/PasswordHashingService';
|
||||
import type { AuthRepository } from '../../domain/repositories/AuthRepository';
|
||||
import type { CompanyRepository } from '../../domain/repositories/CompanyRepository';
|
||||
import type { PasswordHashingService } from '../../domain/services/PasswordHashingService';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import { Result } from '@core/shared/application/Result';
|
||||
import { Result } from '@core/shared/domain/Result';
|
||||
|
||||
describe('SignupSponsorUseCase', () => {
|
||||
let authRepo: {
|
||||
|
||||
@@ -2,10 +2,10 @@ import { EmailAddress } from '../../domain/value-objects/EmailAddress';
|
||||
import { UserId } from '../../domain/value-objects/UserId';
|
||||
import { User } from '../../domain/entities/User';
|
||||
import { Company } from '../../domain/entities/Company';
|
||||
import { IAuthRepository } from '../../domain/repositories/IAuthRepository';
|
||||
import { ICompanyRepository } from '../../domain/repositories/ICompanyRepository';
|
||||
import { IPasswordHashingService } from '../../domain/services/PasswordHashingService';
|
||||
import { Result } from '@core/shared/application/Result';
|
||||
import { AuthRepository } from '../../domain/repositories/AuthRepository';
|
||||
import { CompanyRepository } from '../../domain/repositories/CompanyRepository';
|
||||
import { PasswordHashingService } from '../../domain/services/PasswordHashingService';
|
||||
import { Result } from '@core/shared/domain/Result';
|
||||
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
|
||||
import type { Logger, UseCase } from '@core/shared/application';
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { describe, it, expect, vi, type Mock } from 'vitest';
|
||||
import { SignupUseCase } from './SignupUseCase';
|
||||
import type { IAuthRepository } from '../../domain/repositories/IAuthRepository';
|
||||
import type { IPasswordHashingService } from '../../domain/services/PasswordHashingService';
|
||||
import type { AuthRepository } from '../../domain/repositories/AuthRepository';
|
||||
import type { PasswordHashingService } from '../../domain/services/PasswordHashingService';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import { User } from '../../domain/entities/User';
|
||||
import { UserId } from '../../domain/value-objects/UserId';
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { EmailAddress } from '../../domain/value-objects/EmailAddress';
|
||||
import { UserId } from '../../domain/value-objects/UserId';
|
||||
import { User } from '../../domain/entities/User';
|
||||
import { IAuthRepository } from '../../domain/repositories/IAuthRepository';
|
||||
import { IPasswordHashingService } from '../../domain/services/PasswordHashingService';
|
||||
import { AuthRepository } from '../../domain/repositories/AuthRepository';
|
||||
import { PasswordHashingService } from '../../domain/services/PasswordHashingService';
|
||||
import { PasswordHash } from '../../domain/value-objects/PasswordHash';
|
||||
import { Result } from '@core/shared/application/Result';
|
||||
import { Result } from '@core/shared/domain/Result';
|
||||
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
|
||||
import type { Logger, UseCase } from '@core/shared/application';
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { describe, it, expect, vi, type Mock } from 'vitest';
|
||||
import { SignupWithEmailUseCase } from './SignupWithEmailUseCase';
|
||||
import type { IUserRepository } from '../../domain/repositories/IUserRepository';
|
||||
import type { UserRepository } from '../../domain/repositories/UserRepository';
|
||||
import type { IdentitySessionPort } from '../ports/IdentitySessionPort';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import { Result } from '@core/shared/application/Result';
|
||||
import { Result } from '@core/shared/domain/Result';
|
||||
|
||||
describe('SignupWithEmailUseCase', () => {
|
||||
let userRepository: {
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
* Creates a new user account with email and password.
|
||||
*/
|
||||
|
||||
import type { IUserRepository, StoredUser } from '../../domain/repositories/IUserRepository';
|
||||
import type { UserRepository, StoredUser } from '../../domain/repositories/UserRepository';
|
||||
import type { AuthenticatedUser } from '../ports/IdentityProviderPort';
|
||||
import type { IdentitySessionPort } from '../ports/IdentitySessionPort';
|
||||
import { Result } from '@core/shared/application/Result';
|
||||
import { Result } from '@core/shared/domain/Result';
|
||||
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import { describe, it, expect, vi, type Mock } from 'vitest';
|
||||
import { StartAuthUseCase } from './StartAuthUseCase';
|
||||
import type { IdentityProviderPort } from '../ports/IdentityProviderPort';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import { Result } from '@core/shared/application/Result';
|
||||
import { Result } from '@core/shared/domain/Result';
|
||||
|
||||
describe('StartAuthUseCase', () => {
|
||||
let provider: {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { IdentityProviderPort, AuthProvider, StartAuthCommand } from '../ports/IdentityProviderPort';
|
||||
import { Result } from '@core/shared/application/Result';
|
||||
import { Result } from '@core/shared/domain/Result';
|
||||
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { UpsertExternalGameRatingUseCase } from './UpsertExternalGameRatingUseCase';
|
||||
import { IExternalGameRatingRepository } from '../../domain/repositories/IExternalGameRatingRepository';
|
||||
import { ExternalGameRatingRepository } from '../../domain/repositories/ExternalGameRatingRepository';
|
||||
import { ExternalGameRatingProfile } from '../../domain/entities/ExternalGameRatingProfile';
|
||||
import { UserId } from '../../domain/value-objects/UserId';
|
||||
import { GameKey } from '../../domain/value-objects/GameKey';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { IExternalGameRatingRepository } from '../../domain/repositories/IExternalGameRatingRepository';
|
||||
import { ExternalGameRatingRepository } from '../../domain/repositories/ExternalGameRatingRepository';
|
||||
import { ExternalGameRatingProfile } from '../../domain/entities/ExternalGameRatingProfile';
|
||||
import { UserId } from '../../domain/value-objects/UserId';
|
||||
import { GameKey } from '../../domain/value-objects/GameKey';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { describe, it, expect, vi, type Mock } from 'vitest';
|
||||
import { CreateAchievementUseCase, type IAchievementRepository } from './CreateAchievementUseCase';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import { Result } from '@core/shared/application/Result';
|
||||
import { Result } from '@core/shared/domain/Result';
|
||||
import { Achievement } from '@core/identity/domain/entities/Achievement';
|
||||
|
||||
describe('CreateAchievementUseCase', () => {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { Achievement, AchievementProps } from '@core/identity/domain/entities/Achievement';
|
||||
import { Result } from '@core/shared/application/Result';
|
||||
import { Result } from '@core/shared/domain/Result';
|
||||
import type { ApplicationErrorCode } from '@core/shared/errors/ApplicationErrorCode';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
|
||||
export interface IAchievementRepository {
|
||||
export interface AchievementRepository {
|
||||
save(achievement: Achievement): Promise<void>;
|
||||
findById(id: string): Promise<Achievement | null>;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* Achievements are categorized by role (driver, steward, admin) and type.
|
||||
*/
|
||||
|
||||
import type { IEntity } from '@core/shared/domain';
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
|
||||
export type AchievementCategory = 'driver' | 'steward' | 'admin' | 'community';
|
||||
|
||||
@@ -32,7 +32,7 @@ export interface AchievementRequirement {
|
||||
operator: '>=' | '>' | '=' | '<' | '<=';
|
||||
}
|
||||
|
||||
export class Achievement implements IEntity<string> {
|
||||
export class Achievement implements Entity<string> {
|
||||
readonly id: string;
|
||||
readonly name: string;
|
||||
readonly description: string;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { IEntity } from '@core/shared/domain';
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
import { IdentityDomainValidationError, IdentityDomainInvariantError } from '../errors/IdentityDomainError';
|
||||
|
||||
export interface AdminVote {
|
||||
@@ -42,7 +42,7 @@ export interface AdminVoteSessionProps {
|
||||
*
|
||||
* Based on ratings-architecture-concept.md sections 5.2.1 and 7.1.1
|
||||
*/
|
||||
export class AdminVoteSession implements IEntity<string> {
|
||||
export class AdminVoteSession implements Entity<string> {
|
||||
readonly id: string;
|
||||
readonly leagueId: string;
|
||||
readonly adminId: string;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { IEntity } from '@core/shared/domain';
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
import { RatingEventId } from '../value-objects/RatingEventId';
|
||||
import { RatingDimensionKey } from '../value-objects/RatingDimensionKey';
|
||||
import { RatingDelta } from '../value-objects/RatingDelta';
|
||||
@@ -34,7 +34,7 @@ export interface RatingEventProps {
|
||||
version: number;
|
||||
}
|
||||
|
||||
export class RatingEvent implements IEntity<RatingEventId> {
|
||||
export class RatingEvent implements Entity<RatingEventId> {
|
||||
readonly id: RatingEventId;
|
||||
readonly userId: string;
|
||||
readonly dimension: RatingDimensionKey;
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { EmailValidationResult } from '../types/EmailAddress';
|
||||
import { validateEmail } from '../types/EmailAddress';
|
||||
import { UserId } from '../value-objects/UserId';
|
||||
import { PasswordHash } from '../value-objects/PasswordHash';
|
||||
import { StoredUser } from '../repositories/IUserRepository';
|
||||
import { StoredUser } from '../repositories/UserRepository';
|
||||
|
||||
export interface UserProps {
|
||||
id: UserId;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Represents an achievement earned by a specific user.
|
||||
*/
|
||||
|
||||
import type { IEntity } from '@core/shared/domain';
|
||||
import type { Entity } from '@core/shared/domain';
|
||||
|
||||
export interface UserAchievementProps {
|
||||
id: string;
|
||||
@@ -15,7 +15,7 @@ export interface UserAchievementProps {
|
||||
progress?: number; // For partial progress tracking (0-100)
|
||||
}
|
||||
|
||||
export class UserAchievement implements IEntity<string> {
|
||||
export class UserAchievement implements Entity<string> {
|
||||
readonly id: string;
|
||||
readonly userId: string;
|
||||
readonly achievementId: string;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { IDomainError, CommonDomainErrorKind } from '@core/shared/errors';
|
||||
import type { DomainError, CommonDomainErrorKind } from '@core/shared/errors';
|
||||
|
||||
export abstract class IdentityDomainError extends Error implements IDomainError<CommonDomainErrorKind> {
|
||||
export abstract class IdentityDomainError extends Error implements DomainError<CommonDomainErrorKind> {
|
||||
readonly type = 'domain' as const;
|
||||
readonly context = 'identity-domain';
|
||||
abstract readonly kind: CommonDomainErrorKind;
|
||||
@@ -13,7 +13,7 @@ export abstract class IdentityDomainError extends Error implements IDomainError<
|
||||
|
||||
export class IdentityDomainValidationError
|
||||
extends IdentityDomainError
|
||||
implements IDomainError<'validation'>
|
||||
implements DomainError<'validation'>
|
||||
{
|
||||
readonly kind = 'validation' as const;
|
||||
|
||||
@@ -24,7 +24,7 @@ export class IdentityDomainValidationError
|
||||
|
||||
export class IdentityDomainInvariantError
|
||||
extends IdentityDomainError
|
||||
implements IDomainError<'invariant'>
|
||||
implements DomainError<'invariant'>
|
||||
{
|
||||
readonly kind = 'invariant' as const;
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ export interface MagicLinkNotificationInput {
|
||||
expiresAt: Date;
|
||||
}
|
||||
|
||||
export interface IMagicLinkNotificationPort {
|
||||
export interface MagicLinkNotificationPort {
|
||||
/**
|
||||
* Send a magic link notification to the user
|
||||
* @param input - The notification data
|
||||
@@ -7,7 +7,7 @@
|
||||
import type { Achievement, AchievementCategory } from '../entities/Achievement';
|
||||
import type { UserAchievement } from '../entities/UserAchievement';
|
||||
|
||||
export interface IAchievementRepository {
|
||||
export interface AchievementRepository {
|
||||
// Achievement operations
|
||||
findAchievementById(id: string): Promise<Achievement | null>;
|
||||
findAllAchievements(): Promise<Achievement[]>;
|
||||
@@ -7,7 +7,7 @@ import type { AdminVoteSession } from '../entities/AdminVoteSession';
|
||||
* Sessions are scoped to leagues and control voting windows.
|
||||
*/
|
||||
|
||||
export interface IAdminVoteSessionRepository {
|
||||
export interface AdminVoteSessionRepository {
|
||||
/**
|
||||
* Save a vote session
|
||||
*/
|
||||
@@ -6,7 +6,7 @@ import { User } from '../entities/User';
|
||||
*
|
||||
* Repository interface for authentication operations.
|
||||
*/
|
||||
export interface IAuthRepository {
|
||||
export interface AuthRepository {
|
||||
/**
|
||||
* Find user by email
|
||||
*/
|
||||
@@ -5,7 +5,7 @@ import { Company } from '../entities/Company';
|
||||
*
|
||||
* Repository interface for Company entity operations.
|
||||
*/
|
||||
export interface ICompanyRepository {
|
||||
export interface CompanyRepository {
|
||||
/**
|
||||
* Create a new company (returns unsaved entity)
|
||||
*/
|
||||
@@ -1,4 +1,4 @@
|
||||
import { IExternalGameRatingRepository } from './IExternalGameRatingRepository';
|
||||
import { ExternalGameRatingRepository } from './ExternalGameRatingRepository';
|
||||
import { ExternalGameRatingProfile } from '../entities/ExternalGameRatingProfile';
|
||||
import { UserId } from '../value-objects/UserId';
|
||||
import { GameKey } from '../value-objects/GameKey';
|
||||
@@ -11,7 +11,7 @@ import { ExternalRatingProvenance } from '../value-objects/ExternalRatingProvena
|
||||
*/
|
||||
describe('IExternalGameRatingRepository', () => {
|
||||
// Mock implementation for testing
|
||||
class MockExternalGameRatingRepository implements IExternalGameRatingRepository {
|
||||
class MockExternalGameRatingRepository implements ExternalGameRatingRepository {
|
||||
private profiles: Map<string, ExternalGameRatingProfile> = new Map();
|
||||
|
||||
private getKey(userId: string, gameKey: string): string {
|
||||
@@ -61,7 +61,7 @@ describe('IExternalGameRatingRepository', () => {
|
||||
return this.profiles.has(key);
|
||||
}
|
||||
|
||||
async findProfilesPaginated(userId: string, options?: import('./IExternalGameRatingRepository').PaginatedQueryOptions): Promise<import('./IExternalGameRatingRepository').PaginatedResult<ExternalGameRatingProfile>> {
|
||||
async findProfilesPaginated(userId: string, options?: import('./ExternalGameRatingRepository').PaginatedQueryOptions): Promise<import('./ExternalGameRatingRepository').PaginatedResult<ExternalGameRatingProfile>> {
|
||||
const allProfiles = await this.findByUserId(userId);
|
||||
|
||||
// Apply filters
|
||||
@@ -89,7 +89,7 @@ describe('IExternalGameRatingRepository', () => {
|
||||
const hasMore = offset + limit < total;
|
||||
const nextOffset = hasMore ? offset + limit : undefined;
|
||||
|
||||
const result: import('./IExternalGameRatingRepository').PaginatedResult<ExternalGameRatingProfile> = {
|
||||
const result: import('./ExternalGameRatingRepository').PaginatedResult<ExternalGameRatingProfile> = {
|
||||
items,
|
||||
total,
|
||||
limit,
|
||||
@@ -33,7 +33,7 @@ export interface PaginatedResult<T> {
|
||||
nextOffset?: number;
|
||||
}
|
||||
|
||||
export interface IExternalGameRatingRepository {
|
||||
export interface ExternalGameRatingRepository {
|
||||
/**
|
||||
* Find profile by user ID and game key
|
||||
*/
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Result } from '@core/shared/application/Result';
|
||||
import { Result } from '@core/shared/domain/Result';
|
||||
|
||||
export interface PasswordResetRequest {
|
||||
email: string;
|
||||
@@ -8,7 +8,7 @@ export interface PasswordResetRequest {
|
||||
used?: boolean;
|
||||
}
|
||||
|
||||
export interface IMagicLinkRepository {
|
||||
export interface MagicLinkRepository {
|
||||
/**
|
||||
* Create a password reset request
|
||||
*/
|
||||
@@ -6,10 +6,10 @@ import { RatingEvent } from '../entities/RatingEvent';
|
||||
import { RatingEventId } from '../value-objects/RatingEventId';
|
||||
import { RatingDimensionKey } from '../value-objects/RatingDimensionKey';
|
||||
import { RatingDelta } from '../value-objects/RatingDelta';
|
||||
import { IRatingEventRepository, FindByUserIdOptions, PaginatedQueryOptions, PaginatedResult } from './IRatingEventRepository';
|
||||
import { RatingEventRepository, FindByUserIdOptions, PaginatedQueryOptions, PaginatedResult } from './RatingEventRepository';
|
||||
|
||||
// In-memory test implementation
|
||||
class InMemoryRatingEventRepository implements IRatingEventRepository {
|
||||
class InMemoryRatingEventRepository implements RatingEventRepository {
|
||||
private events: RatingEvent[] = [];
|
||||
|
||||
async save(event: RatingEvent): Promise<RatingEvent> {
|
||||
@@ -44,7 +44,7 @@ export interface PaginatedResult<T> {
|
||||
nextOffset?: number;
|
||||
}
|
||||
|
||||
export interface IRatingEventRepository {
|
||||
export interface RatingEventRepository {
|
||||
/**
|
||||
* Save a rating event to the ledger
|
||||
*/
|
||||
@@ -7,7 +7,7 @@
|
||||
import type { SponsorAccount } from '../entities/SponsorAccount';
|
||||
import type { UserId } from '../value-objects/UserId';
|
||||
|
||||
export interface ISponsorAccountRepository {
|
||||
export interface SponsorAccountRepository {
|
||||
save(account: SponsorAccount): Promise<void>;
|
||||
findById(id: UserId): Promise<SponsorAccount | null>;
|
||||
findBySponsorId(sponsorId: string): Promise<SponsorAccount | null>;
|
||||
@@ -3,10 +3,10 @@
|
||||
*/
|
||||
|
||||
import { UserRating } from '../value-objects/UserRating';
|
||||
import { IUserRatingRepository } from './IUserRatingRepository';
|
||||
import { UserRatingRepository } from './UserRatingRepository';
|
||||
|
||||
// In-memory test implementation
|
||||
class InMemoryUserRatingRepository implements IUserRatingRepository {
|
||||
class InMemoryUserRatingRepository implements UserRatingRepository {
|
||||
private ratings: Map<string, UserRating> = new Map();
|
||||
|
||||
async findByUserId(userId: string): Promise<UserRating | null> {
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
import type { UserRating } from '../value-objects/UserRating';
|
||||
|
||||
export interface IUserRatingRepository {
|
||||
export interface UserRatingRepository {
|
||||
/**
|
||||
* Find rating snapshot by user ID
|
||||
*/
|
||||
@@ -20,7 +20,7 @@ export interface StoredUser {
|
||||
createdAt: Date;
|
||||
}
|
||||
|
||||
export interface IUserRepository {
|
||||
export interface UserRepository {
|
||||
/**
|
||||
* Find user by email
|
||||
*/
|
||||
@@ -5,7 +5,7 @@ import { PasswordHash } from '../value-objects/PasswordHash';
|
||||
*
|
||||
* Service for password hashing and verification.
|
||||
*/
|
||||
export interface IPasswordHashingService {
|
||||
export interface PasswordHashingService {
|
||||
hash(plain: string): Promise<string>;
|
||||
verify(plain: string, hash: string): Promise<boolean>;
|
||||
}
|
||||
@@ -13,7 +13,7 @@ export interface IPasswordHashingService {
|
||||
/**
|
||||
* Implementation using bcrypt via PasswordHash VO.
|
||||
*/
|
||||
export class PasswordHashingService implements IPasswordHashingService {
|
||||
export class PasswordHashingService implements PasswordHashingService {
|
||||
async hash(plain: string): Promise<string> {
|
||||
const passwordHash = await PasswordHash.create(plain);
|
||||
return passwordHash.value;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { describe, it, expect, beforeEach, vi } from 'vitest';
|
||||
import { RatingUpdateService } from './RatingUpdateService';
|
||||
import type { IUserRatingRepository } from '../repositories/IUserRatingRepository';
|
||||
import type { IRatingEventRepository } from '../repositories/IRatingEventRepository';
|
||||
import type { UserRatingRepository } from '../repositories/UserRatingRepository';
|
||||
import type { RatingEventRepository } from '../repositories/RatingEventRepository';
|
||||
import { UserRating } from '../value-objects/UserRating';
|
||||
import { RatingEvent } from '../entities/RatingEvent';
|
||||
import { RatingEventId } from '../value-objects/RatingEventId';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { IDomainService } from '@core/shared/domain';
|
||||
import type { IUserRatingRepository } from '../repositories/IUserRatingRepository';
|
||||
import type { IRatingEventRepository } from '../repositories/IRatingEventRepository';
|
||||
import type { DomainService } from '@core/shared/domain';
|
||||
import type { UserRatingRepository } from '../repositories/UserRatingRepository';
|
||||
import type { RatingEventRepository } from '../repositories/RatingEventRepository';
|
||||
import { RatingEventFactory } from './RatingEventFactory';
|
||||
import { RatingSnapshotCalculator } from './RatingSnapshotCalculator';
|
||||
import { RatingEvent } from '../entities/RatingEvent';
|
||||
@@ -17,7 +17,7 @@ import { RatingDelta } from '../value-objects/RatingDelta';
|
||||
* EVOLVED (Slice 7): Now uses event-driven approach with ledger pattern.
|
||||
* Records rating events and recomputes snapshots for transparency and auditability.
|
||||
*/
|
||||
export class RatingUpdateService implements IDomainService {
|
||||
export class RatingUpdateService implements DomainService {
|
||||
readonly serviceName = 'RatingUpdateService';
|
||||
|
||||
constructor(
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { IValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
import { IdentityDomainValidationError } from '../errors/IdentityDomainError';
|
||||
|
||||
/**
|
||||
@@ -37,7 +37,7 @@ const VALID_REASON_CODES: AdminTrustReasonCodeValue[] = [
|
||||
'ADMIN_ACTION_ABUSE_REPORT_PENALTY',
|
||||
];
|
||||
|
||||
export class AdminTrustReasonCode implements IValueObject<AdminTrustReasonCodeProps> {
|
||||
export class AdminTrustReasonCode implements ValueObject<AdminTrustReasonCodeProps> {
|
||||
readonly value: AdminTrustReasonCodeValue;
|
||||
|
||||
private constructor(value: AdminTrustReasonCodeValue) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { IValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
import { IdentityDomainValidationError } from '../errors/IdentityDomainError';
|
||||
|
||||
/**
|
||||
@@ -49,7 +49,7 @@ const VALID_REASON_CODES: DrivingReasonCodeValue[] = [
|
||||
'DRIVING_SEASON_ATTENDANCE_BONUS',
|
||||
];
|
||||
|
||||
export class DrivingReasonCode implements IValueObject<DrivingReasonCodeProps> {
|
||||
export class DrivingReasonCode implements ValueObject<DrivingReasonCodeProps> {
|
||||
readonly value: DrivingReasonCodeValue;
|
||||
|
||||
private constructor(value: DrivingReasonCodeValue) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { IValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
import type { EmailValidationResult } from '../types/EmailAddress';
|
||||
import { validateEmail, isDisposableEmail } from '../types/EmailAddress';
|
||||
|
||||
@@ -12,7 +12,7 @@ export interface EmailAddressProps {
|
||||
* Wraps a validated, normalized email string and provides equality semantics.
|
||||
* Validation and helper utilities live in domain/types/EmailAddress.
|
||||
*/
|
||||
export class EmailAddress implements IValueObject<EmailAddressProps> {
|
||||
export class EmailAddress implements ValueObject<EmailAddressProps> {
|
||||
public readonly props: EmailAddressProps;
|
||||
|
||||
private constructor(value: string) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { IValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
import { IdentityDomainValidationError } from '../errors/IdentityDomainError';
|
||||
import { GameKey } from './GameKey';
|
||||
|
||||
@@ -8,7 +8,7 @@ export interface ExternalRatingProps {
|
||||
value: number;
|
||||
}
|
||||
|
||||
export class ExternalRating implements IValueObject<ExternalRatingProps> {
|
||||
export class ExternalRating implements ValueObject<ExternalRatingProps> {
|
||||
readonly gameKey: GameKey;
|
||||
readonly type: string;
|
||||
readonly value: number;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { IValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
import { IdentityDomainValidationError } from '../errors/IdentityDomainError';
|
||||
|
||||
export interface ExternalRatingProvenanceProps {
|
||||
@@ -7,7 +7,7 @@ export interface ExternalRatingProvenanceProps {
|
||||
verified?: boolean;
|
||||
}
|
||||
|
||||
export class ExternalRatingProvenance implements IValueObject<ExternalRatingProvenanceProps> {
|
||||
export class ExternalRatingProvenance implements ValueObject<ExternalRatingProvenanceProps> {
|
||||
readonly source: string;
|
||||
readonly lastSyncedAt: Date;
|
||||
readonly verified: boolean;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import type { IValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
import { IdentityDomainValidationError } from '../errors/IdentityDomainError';
|
||||
|
||||
export interface GameKeyProps {
|
||||
value: string;
|
||||
}
|
||||
|
||||
export class GameKey implements IValueObject<GameKeyProps> {
|
||||
export class GameKey implements ValueObject<GameKeyProps> {
|
||||
readonly value: string;
|
||||
|
||||
private constructor(value: string) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import bcrypt from 'bcrypt';
|
||||
import type { IValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
|
||||
export interface PasswordHashProps {
|
||||
value: string;
|
||||
@@ -10,7 +10,7 @@ export interface PasswordHashProps {
|
||||
*
|
||||
* Wraps a bcrypt-hashed password string and provides verification.
|
||||
*/
|
||||
export class PasswordHash implements IValueObject<PasswordHashProps> {
|
||||
export class PasswordHash implements ValueObject<PasswordHashProps> {
|
||||
public readonly props: PasswordHashProps;
|
||||
|
||||
private constructor(value: string) {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import type { IValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
import { IdentityDomainValidationError } from '../errors/IdentityDomainError';
|
||||
|
||||
export interface RatingDeltaProps {
|
||||
value: number;
|
||||
}
|
||||
|
||||
export class RatingDelta implements IValueObject<RatingDeltaProps> {
|
||||
export class RatingDelta implements ValueObject<RatingDeltaProps> {
|
||||
readonly value: number;
|
||||
|
||||
private constructor(value: number) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { IValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
import { IdentityDomainValidationError } from '../errors/IdentityDomainError';
|
||||
|
||||
export interface RatingDimensionKeyProps {
|
||||
@@ -7,7 +7,7 @@ export interface RatingDimensionKeyProps {
|
||||
|
||||
const VALID_DIMENSIONS = ['driving', 'adminTrust', 'stewardTrust', 'broadcasterTrust'] as const;
|
||||
|
||||
export class RatingDimensionKey implements IValueObject<RatingDimensionKeyProps> {
|
||||
export class RatingDimensionKey implements ValueObject<RatingDimensionKeyProps> {
|
||||
readonly value: RatingDimensionKeyProps['value'];
|
||||
|
||||
private constructor(value: RatingDimensionKeyProps['value']) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { IValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
import { IdentityDomainValidationError } from '../errors/IdentityDomainError';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
|
||||
@@ -6,7 +6,7 @@ export interface RatingEventIdProps {
|
||||
value: string;
|
||||
}
|
||||
|
||||
export class RatingEventId implements IValueObject<RatingEventIdProps> {
|
||||
export class RatingEventId implements ValueObject<RatingEventIdProps> {
|
||||
readonly value: string;
|
||||
|
||||
private constructor(value: string) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { IValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
import { IdentityDomainValidationError } from '../errors/IdentityDomainError';
|
||||
|
||||
export type RatingReferenceType = 'race' | 'penalty' | 'vote' | 'adminAction';
|
||||
@@ -10,7 +10,7 @@ export interface RatingReferenceProps {
|
||||
|
||||
const VALID_TYPES: RatingReferenceType[] = ['race', 'penalty', 'vote', 'adminAction'];
|
||||
|
||||
export class RatingReference implements IValueObject<RatingReferenceProps> {
|
||||
export class RatingReference implements ValueObject<RatingReferenceProps> {
|
||||
readonly type: RatingReferenceType;
|
||||
readonly id: string;
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import type { IValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
import { IdentityDomainValidationError } from '../errors/IdentityDomainError';
|
||||
|
||||
export interface RatingValueProps {
|
||||
value: number;
|
||||
}
|
||||
|
||||
export class RatingValue implements IValueObject<RatingValueProps> {
|
||||
export class RatingValue implements ValueObject<RatingValueProps> {
|
||||
readonly value: number;
|
||||
|
||||
private constructor(value: number) {
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
import type { IValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
|
||||
export interface UserIdProps {
|
||||
value: string;
|
||||
}
|
||||
|
||||
export class UserId implements IValueObject<UserIdProps> {
|
||||
export class UserId implements ValueObject<UserIdProps> {
|
||||
public readonly props: UserIdProps;
|
||||
|
||||
private constructor(value: string) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { IValueObject } from '@core/shared/domain';
|
||||
import type { ValueObject } from '@core/shared/domain';
|
||||
|
||||
/**
|
||||
* Value Object: UserRating
|
||||
@@ -40,7 +40,7 @@ const DEFAULT_DIMENSION: RatingDimension = {
|
||||
lastUpdated: new Date(),
|
||||
};
|
||||
|
||||
export class UserRating implements IValueObject<UserRatingProps> {
|
||||
export class UserRating implements ValueObject<UserRatingProps> {
|
||||
readonly props: UserRatingProps;
|
||||
|
||||
private constructor(props: UserRatingProps) {
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
export * from './domain/value-objects/EmailAddress';
|
||||
export * from './domain/value-objects/UserId';
|
||||
export * from './domain/value-objects/UserRating';
|
||||
export * from './domain/entities/User';
|
||||
export * from './domain/entities/SponsorAccount';
|
||||
export * from './domain/entities/Achievement';
|
||||
export * from './domain/entities/UserAchievement';
|
||||
|
||||
export * from './domain/repositories/IUserRepository';
|
||||
export * from './domain/repositories/ISponsorAccountRepository';
|
||||
export * from './domain/repositories/IUserRatingRepository';
|
||||
export * from './domain/repositories/IAchievementRepository';
|
||||
export * from './domain/repositories/IAuthRepository';
|
||||
export * from './domain/repositories/IMagicLinkRepository';
|
||||
|
||||
export * from './application/ports/IdentityProviderPort';
|
||||
export * from './application/ports/IdentitySessionPort';
|
||||
|
||||
export * from './application/use-cases/StartAuthUseCase';
|
||||
export * from './application/use-cases/HandleAuthCallbackUseCase';
|
||||
export * from './application/use-cases/GetCurrentUserSessionUseCase';
|
||||
export * from './application/use-cases/LogoutUseCase';
|
||||
export * from './application/use-cases/SignupUseCase';
|
||||
export * from './application/use-cases/LoginUseCase';
|
||||
export * from './application/use-cases/ForgotPasswordUseCase';
|
||||
export * from './application/use-cases/ResetPasswordUseCase';
|
||||
Reference in New Issue
Block a user