website refactor
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import type { Logger } from '@core/shared/domain';
|
||||
import type { UserAchievement } from '@core/identity';
|
||||
import { InMemoryAchievementRepository } from './InMemoryAchievementRepository';
|
||||
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
|
||||
import { Achievement, AchievementCategory, IAchievementRepository, UserAchievement } from "@core/identity";
|
||||
import { ADMIN_ACHIEVEMENTS, COMMUNITY_ACHIEVEMENTS, DRIVER_ACHIEVEMENTS, STEWARD_ACHIEVEMENTS } from "@core/identity/domain/AchievementConstants";
|
||||
import { Logger } from "@core/shared/application";
|
||||
import { Logger } from "@core/shared/domain";
|
||||
|
||||
|
||||
|
||||
export class InMemoryAchievementRepository implements IAchievementRepository {
|
||||
export class InMemoryAchievementRepository implements AchievementRepository {
|
||||
private achievements: Map<string, Achievement> = new Map();
|
||||
private userAchievements: Map<string, UserAchievement> = new Map();
|
||||
private readonly logger: Logger;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import type { Logger } from '@core/shared/domain';
|
||||
import { UserId } from '@core/identity';
|
||||
import { User } from '@core/identity/domain/entities/User';
|
||||
import { InMemoryUserRepository } from './InMemoryUserRepository';
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import { User } from '@core/identity/domain/entities/User';
|
||||
import { IAuthRepository } from '@core/identity/domain/repositories/IAuthRepository';
|
||||
import { IUserRepository, StoredUser } from '@core/identity/domain/repositories/IUserRepository';
|
||||
import { IPasswordHashingService } from '@core/identity/domain/services/PasswordHashingService';
|
||||
import { AuthRepository } from '@core/identity/domain/repositories/AuthRepository';
|
||||
import { UserRepository, StoredUser } from '@core/identity/domain/repositories/UserRepository';
|
||||
import { PasswordHashingService } from '@core/identity/domain/services/PasswordHashingService';
|
||||
|
||||
import { EmailAddress } from '@core/identity/domain/value-objects/EmailAddress';
|
||||
import { Logger } from '@core/shared/application';
|
||||
import { Logger } from '@core/shared/domain';
|
||||
|
||||
export class InMemoryAuthRepository implements IAuthRepository {
|
||||
export class InMemoryAuthRepository implements AuthRepository {
|
||||
constructor(
|
||||
private readonly userRepository: IUserRepository,
|
||||
private readonly passwordHashingService: IPasswordHashingService,
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { Company } from '@core/identity/domain/entities/Company';
|
||||
import { ICompanyRepository } from '@core/identity/domain/repositories/ICompanyRepository';
|
||||
import { CompanyRepository } from '@core/identity/domain/repositories/CompanyRepository';
|
||||
|
||||
/**
|
||||
* In-memory implementation of ICompanyRepository for testing
|
||||
*/
|
||||
export class InMemoryCompanyRepository implements ICompanyRepository {
|
||||
export class InMemoryCompanyRepository implements CompanyRepository {
|
||||
private companies: Map<string, Company> = new Map();
|
||||
|
||||
create(company: Pick<Company, 'getName' | 'getOwnerUserId' | 'getContactEmail'>): Company {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { IExternalGameRatingRepository, PaginatedQueryOptions, PaginatedResult } from '@core/identity/domain/repositories/IExternalGameRatingRepository';
|
||||
import { ExternalGameRatingRepository, PaginatedQueryOptions, PaginatedResult } from '@core/identity/domain/repositories/ExternalGameRatingRepository';
|
||||
import { ExternalGameRatingProfile } from '@core/identity/domain/entities/ExternalGameRatingProfile';
|
||||
|
||||
/**
|
||||
@@ -6,7 +6,7 @@ import { ExternalGameRatingProfile } from '@core/identity/domain/entities/Extern
|
||||
*
|
||||
* For testing and development purposes.
|
||||
*/
|
||||
export class InMemoryExternalGameRatingRepository implements IExternalGameRatingRepository {
|
||||
export class InMemoryExternalGameRatingRepository implements ExternalGameRatingRepository {
|
||||
private profiles: Map<string, ExternalGameRatingProfile> = new Map();
|
||||
|
||||
private getKey(userId: string, gameKey: string): string {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { IMagicLinkRepository, PasswordResetRequest } from '@core/identity/domain/repositories/IMagicLinkRepository';
|
||||
import { Result } from '@core/shared/application/Result';
|
||||
import { Logger } from '@core/shared/application';
|
||||
import { MagicLinkRepository, PasswordResetRequest } from '@core/identity/domain/repositories/MagicLinkRepository';
|
||||
import { Result } from '@core/shared/domain/Result';
|
||||
import { Logger } from '@core/shared/domain';
|
||||
|
||||
export class InMemoryMagicLinkRepository implements IMagicLinkRepository {
|
||||
export class InMemoryMagicLinkRepository implements MagicLinkRepository {
|
||||
private resetRequests: Map<string, PasswordResetRequest> = new Map();
|
||||
private rateLimitStore: Map<string, { count: number; lastRequest: Date }> = new Map();
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import type { Logger } from '@core/shared/domain';
|
||||
import { UserId, type SponsorAccount } from '@core/identity';
|
||||
import { InMemorySponsorAccountRepository } from './InMemorySponsorAccountRepository';
|
||||
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
* In-memory implementation of ISponsorAccountRepository for development/testing.
|
||||
*/
|
||||
|
||||
import { ISponsorAccountRepository, SponsorAccount, UserId } from '@core/identity';
|
||||
import { Logger } from '@core/shared/application';
|
||||
import { SponsorAccountRepository, SponsorAccount, UserId } from '@core/identity';
|
||||
import { Logger } from '@core/shared/domain';
|
||||
|
||||
export class InMemorySponsorAccountRepository implements ISponsorAccountRepository {
|
||||
export class InMemorySponsorAccountRepository implements SponsorAccountRepository {
|
||||
private accounts: Map<string, SponsorAccount> = new Map();
|
||||
private readonly logger: Logger;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import type { Logger } from '@core/shared/domain';
|
||||
import type { UserRating } from '@core/identity';
|
||||
import { InMemoryUserRatingRepository } from './InMemoryUserRatingRepository';
|
||||
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
* In-memory implementation of IUserRatingRepository
|
||||
*/
|
||||
|
||||
import { IUserRatingRepository, UserRating } from '@core/identity';
|
||||
import { Logger } from '@core/shared/application';
|
||||
import { UserRatingRepository, UserRating } from '@core/identity';
|
||||
import { Logger } from '@core/shared/domain';
|
||||
|
||||
export class InMemoryUserRatingRepository implements IUserRatingRepository {
|
||||
export class InMemoryUserRatingRepository implements UserRatingRepository {
|
||||
private ratings: Map<string, UserRating> = new Map();
|
||||
private readonly logger: Logger;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import type { Logger } from '@core/shared/application';
|
||||
import type { StoredUser } from '@core/identity/domain/repositories/IUserRepository';
|
||||
import type { Logger } from '@core/shared/domain';
|
||||
import type { StoredUser } from '@core/identity/domain/repositories/UserRepository';
|
||||
import { InMemoryUserRepository } from './InMemoryUserRepository';
|
||||
|
||||
describe('InMemoryUserRepository', () => {
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
* Stores users in memory for demo/development purposes.
|
||||
*/
|
||||
|
||||
import { Logger } from '@core/shared/application';
|
||||
import type { IUserRepository, StoredUser } from '@core/identity/domain/repositories/IUserRepository';
|
||||
import { Logger } from '@core/shared/domain';
|
||||
import type { UserRepository, StoredUser } from '@core/identity/domain/repositories/UserRepository';
|
||||
|
||||
export class InMemoryUserRepository implements IUserRepository {
|
||||
export class InMemoryUserRepository implements UserRepository {
|
||||
private users: Map<string, StoredUser> = new Map();
|
||||
private emailIndex: Map<string, string> = new Map(); // email -> userId
|
||||
private readonly logger: Logger;
|
||||
|
||||
Reference in New Issue
Block a user