website refactor

This commit is contained in:
2026-01-16 16:46:57 +01:00
parent 37b1aa626c
commit 2f53727702
445 changed files with 1160 additions and 1150 deletions

View File

@@ -39,7 +39,7 @@ describe('DeleteMediaUseCase', () => {
} as unknown as Logger;
useCase = new DeleteMediaUseCase(
mediaRepo as unknown as IMediaRepository,
mediaRepo as unknown as MediaRepository,
mediaStorage as unknown as MediaStoragePort,
logger,
);

View File

@@ -26,7 +26,7 @@ export type DeleteMediaApplicationError = ApplicationErrorCode<
export class DeleteMediaUseCase {
constructor(
private readonly mediaRepo: IMediaRepository,
private readonly mediaRepo: MediaRepository,
private readonly mediaStorage: MediaStoragePort,
private readonly logger: Logger,
) {}

View File

@@ -31,7 +31,7 @@ describe('GetAvatarUseCase', () => {
} as unknown as Logger;
useCase = new GetAvatarUseCase(
avatarRepo as unknown as IAvatarRepository,
avatarRepo as unknown as AvatarRepository,
logger,
);
});

View File

@@ -29,7 +29,7 @@ export type GetAvatarApplicationError = ApplicationErrorCode<
export class GetAvatarUseCase {
constructor(
private readonly avatarRepo: IAvatarRepository,
private readonly avatarRepo: AvatarRepository,
private readonly logger: Logger,
) {}

View File

@@ -29,7 +29,7 @@ describe('GetMediaUseCase', () => {
} as unknown as Logger;
useCase = new GetMediaUseCase(
mediaRepo as unknown as IMediaRepository,
mediaRepo as unknown as MediaRepository,
logger,
);
});

View File

@@ -30,7 +30,7 @@ export type GetMediaErrorCode = 'MEDIA_NOT_FOUND' | 'REPOSITORY_ERROR';
export class GetMediaUseCase {
constructor(
private readonly mediaRepo: IMediaRepository,
private readonly mediaRepo: MediaRepository,
private readonly logger: Logger,
) {}

View File

@@ -43,7 +43,7 @@ describe('RequestAvatarGenerationUseCase', () => {
} as unknown as Logger;
useCase = new RequestAvatarGenerationUseCase(
avatarRepo as unknown as IAvatarGenerationRepository,
avatarRepo as unknown as AvatarGenerationRepository,
faceValidation as unknown as FaceValidationPort,
avatarGeneration as unknown as AvatarGenerationPort,
logger,

View File

@@ -38,7 +38,7 @@ export type RequestAvatarGenerationApplicationError = ApplicationErrorCode<
export class RequestAvatarGenerationUseCase {
constructor(
private readonly avatarRepo: IAvatarGenerationRepository,
private readonly avatarRepo: AvatarGenerationRepository,
private readonly faceValidation: FaceValidationPort,
private readonly avatarGeneration: AvatarGenerationPort,
private readonly logger: Logger,

View File

@@ -28,7 +28,7 @@ describe('SelectAvatarUseCase', () => {
} as unknown as Logger;
useCase = new SelectAvatarUseCase(
avatarRepo as unknown as IAvatarGenerationRepository,
avatarRepo as unknown as AvatarGenerationRepository,
logger,
);
});

View File

@@ -29,7 +29,7 @@ export type SelectAvatarApplicationError = ApplicationErrorCode<
export class SelectAvatarUseCase {
constructor(
private readonly avatarRepo: IAvatarGenerationRepository,
private readonly avatarRepo: AvatarGenerationRepository,
private readonly logger: Logger,
) {}

View File

@@ -33,7 +33,7 @@ describe('UpdateAvatarUseCase', () => {
} as unknown as Logger;
useCase = new UpdateAvatarUseCase(
avatarRepo as unknown as IAvatarRepository,
avatarRepo as unknown as AvatarRepository,
logger,
);
});

View File

@@ -30,7 +30,7 @@ export type UpdateAvatarApplicationError = ApplicationErrorCode<
export class UpdateAvatarUseCase {
constructor(
private readonly avatarRepo: IAvatarRepository,
private readonly avatarRepo: AvatarRepository,
private readonly logger: Logger,
) {}

View File

@@ -53,7 +53,7 @@ describe('UploadMediaUseCase', () => {
} as unknown as Logger;
useCase = new UploadMediaUseCase(
mediaRepo as unknown as IMediaRepository,
mediaRepo as unknown as MediaRepository,
mediaStorage as unknown as MediaStoragePort,
logger,
);

View File

@@ -41,7 +41,7 @@ export type UploadMediaErrorCode =
export class UploadMediaUseCase {
constructor(
private readonly mediaRepo: IMediaRepository,
private readonly mediaRepo: MediaRepository,
private readonly mediaStorage: MediaStoragePort,
private readonly logger: Logger,
) {}

View File

@@ -4,7 +4,7 @@
* Represents a user's selected avatar.
*/
import type { Entity } from '@core/shared/domain/Entity';
import { Entity } from '@core/shared/domain/Entity';
import { MediaUrl } from '../value-objects/MediaUrl';
export interface AvatarProps {
@@ -15,15 +15,15 @@ export interface AvatarProps {
isActive: boolean;
}
export class Avatar implements Entity<string> {
readonly id: string;
export class Avatar extends Entity<string> {
readonly driverId: string;
readonly mediaUrl: MediaUrl;
readonly selectedAt: Date;
private _isActive: boolean;
private constructor(props: AvatarProps) {
this.id = props.id;
super(props.id);
this.driverId = props.driverId;
this.mediaUrl = MediaUrl.create(props.mediaUrl);
this.selectedAt = props.selectedAt;

View File

@@ -4,7 +4,7 @@
* Represents a request to generate a racing avatar from a face photo.
*/
import type { Entity } from '@core/shared/domain/Entity';
import { Entity } from '@core/shared/domain/Entity';
import type {
AvatarGenerationRequestProps,
AvatarGenerationStatus,
@@ -13,8 +13,7 @@ import type {
} from '../types/AvatarGenerationRequest';
import { MediaUrl } from '../value-objects/MediaUrl';
export class AvatarGenerationRequest implements Entity<string> {
readonly id: string;
export class AvatarGenerationRequest extends Entity<string> {
readonly userId: string;
readonly facePhotoUrl: MediaUrl;
readonly suitColor: RacingSuitColor;
@@ -27,7 +26,8 @@ export class AvatarGenerationRequest implements Entity<string> {
private _updatedAt: Date;
private constructor(props: AvatarGenerationRequestProps) {
this.id = props.id;
super(props.id);
this.userId = props.userId;
this.facePhotoUrl = MediaUrl.create(props.facePhotoUrl);
this.suitColor = props.suitColor;

View File

@@ -4,7 +4,7 @@
* Represents a media file (image, video, etc.) stored in the system.
*/
import type { Entity } from '@core/shared/domain/Entity';
import { Entity } from '@core/shared/domain/Entity';
import { MediaUrl } from '../value-objects/MediaUrl';
export type MediaType = 'image' | 'video' | 'document';
@@ -22,8 +22,7 @@ export interface MediaProps {
metadata?: Record<string, unknown> | undefined;
}
export class Media implements Entity<string> {
readonly id: string;
export class Media extends Entity<string> {
readonly filename: string;
readonly originalName: string;
readonly mimeType: string;
@@ -35,7 +34,8 @@ export class Media implements Entity<string> {
readonly metadata?: Record<string, unknown> | undefined;
private constructor(props: MediaProps) {
this.id = props.id;
super(props.id);
this.filename = props.filename;
this.originalName = props.originalName;
this.mimeType = props.mimeType;

View File

@@ -1,5 +1,5 @@
/**
* Repository Interface: IAvatarGenerationRepository
* Repository Interface: AvatarGenerationRepository
*
* Defines the contract for avatar generation request persistence.
*/

View File

@@ -1,5 +1,5 @@
/**
* Repository Interface: IAvatarRepository
* Repository Interface: AvatarRepository
*
* Defines the contract for avatar persistence.
*/

View File

@@ -1,5 +1,5 @@
/**
* Repository Interface: IMediaRepository
* Repository Interface: MediaRepository
*
* Defines the contract for media file persistence.
*/

View File

@@ -1,4 +1,4 @@
import type { ValueObject } from '@core/shared/domain';
import type { ValueObject } from '@core/shared/domain/ValueObject';
export interface AvatarIdProps {
value: string;
@@ -25,7 +25,7 @@ export class AvatarId implements ValueObject<AvatarIdProps> {
return this.props.value;
}
equals(other: IValueObject<AvatarIdProps>): boolean {
equals(other: ValueObject<AvatarIdProps>): boolean {
return this.props.value === other.props.value;
}
}

View File

@@ -1,4 +1,4 @@
import type { ValueObject } from '@core/shared/domain';
import type { ValueObject } from '@core/shared/domain/ValueObject';
/**
* Value Object: MediaUrl
@@ -40,7 +40,7 @@ export class MediaUrl implements ValueObject<MediaUrlProps> {
return this.props.value;
}
equals(other: IValueObject<MediaUrlProps>): boolean {
equals(other: ValueObject<MediaUrlProps>): boolean {
return this.props.value === other.props.value;
}
}