website refactor
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Repository Interface: IAvatarGenerationRepository
|
||||
* Repository Interface: AvatarGenerationRepository
|
||||
*
|
||||
* Defines the contract for avatar generation request persistence.
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Repository Interface: IAvatarRepository
|
||||
* Repository Interface: AvatarRepository
|
||||
*
|
||||
* Defines the contract for avatar persistence.
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Repository Interface: IMediaRepository
|
||||
* Repository Interface: MediaRepository
|
||||
*
|
||||
* Defines the contract for media file persistence.
|
||||
*/
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user