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