website refactor
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
* Achievements are categorized by role (driver, steward, admin) and type.
|
||||
*/
|
||||
|
||||
import type { Entity } from '@core/shared/domain/Entity';
|
||||
import { Entity } from '@core/shared/domain/Entity';
|
||||
|
||||
export type AchievementCategory = 'driver' | 'steward' | 'admin' | 'community';
|
||||
|
||||
@@ -32,8 +32,7 @@ export interface AchievementRequirement {
|
||||
operator: '>=' | '>' | '=' | '<' | '<=';
|
||||
}
|
||||
|
||||
export class Achievement implements Entity<string> {
|
||||
readonly id: string;
|
||||
export class Achievement extends Entity<string> {
|
||||
readonly name: string;
|
||||
readonly description: string;
|
||||
readonly category: AchievementCategory;
|
||||
@@ -45,7 +44,8 @@ export class Achievement implements Entity<string> {
|
||||
readonly createdAt: Date;
|
||||
|
||||
private constructor(props: AchievementProps) {
|
||||
this.id = props.id;
|
||||
super(props.id);
|
||||
|
||||
this.name = props.name;
|
||||
this.description = props.description;
|
||||
this.category = props.category;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Entity, IEntity } from '@core/shared/domain/Entity';
|
||||
import { Entity } from '@core/shared/domain/Entity';
|
||||
import { IdentityDomainInvariantError, IdentityDomainValidationError } from '../errors/IdentityDomainError';
|
||||
|
||||
export interface AdminVote {
|
||||
@@ -42,8 +42,7 @@ export interface AdminVoteSessionProps {
|
||||
*
|
||||
* Based on ratings-architecture-concept.md sections 5.2.1 and 7.1.1
|
||||
*/
|
||||
export class AdminVoteSession implements Entity<string> {
|
||||
readonly id: string;
|
||||
export class AdminVoteSession extends Entity<string> {
|
||||
readonly leagueId: string;
|
||||
readonly adminId: string;
|
||||
readonly startDate: Date;
|
||||
@@ -56,7 +55,7 @@ export class AdminVoteSession implements Entity<string> {
|
||||
private _updatedAt: Date;
|
||||
|
||||
private constructor(props: AdminVoteSessionProps) {
|
||||
this.id = props.voteSessionId;
|
||||
super(props.voteSessionId);
|
||||
this.leagueId = props.leagueId;
|
||||
this.adminId = props.adminId;
|
||||
this.startDate = props.startDate;
|
||||
@@ -269,7 +268,7 @@ export class AdminVoteSession implements Entity<string> {
|
||||
return now >= this.startDate && now <= this.endDate && !this._closed;
|
||||
}
|
||||
|
||||
equals(other: IEntity<string>): boolean {
|
||||
equals(other: Entity<string>): boolean {
|
||||
return this.id === other.id;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { Entity, IEntity } from '@core/shared/domain/Entity';
|
||||
import { Entity } from '@core/shared/domain/Entity';
|
||||
import { IdentityDomainInvariantError, IdentityDomainValidationError } from '../errors/IdentityDomainError';
|
||||
import { RatingDelta } from '../value-objects/RatingDelta';
|
||||
import { RatingDimensionKey } from '../value-objects/RatingDimensionKey';
|
||||
@@ -34,8 +34,7 @@ export interface RatingEventProps {
|
||||
version: number;
|
||||
}
|
||||
|
||||
export class RatingEvent implements Entity<RatingEventId> {
|
||||
readonly id: RatingEventId;
|
||||
export class RatingEvent extends Entity<RatingEventId> {
|
||||
readonly userId: string;
|
||||
readonly dimension: RatingDimensionKey;
|
||||
readonly delta: RatingDelta;
|
||||
@@ -48,7 +47,8 @@ export class RatingEvent implements Entity<RatingEventId> {
|
||||
readonly version: number;
|
||||
|
||||
private constructor(props: RatingEventProps) {
|
||||
this.id = props.id;
|
||||
super(props.id);
|
||||
|
||||
this.userId = props.userId;
|
||||
this.dimension = props.dimension;
|
||||
this.delta = props.delta;
|
||||
@@ -118,7 +118,7 @@ export class RatingEvent implements Entity<RatingEventId> {
|
||||
return new RatingEvent(props);
|
||||
}
|
||||
|
||||
equals(other: IEntity<RatingEventId>): boolean {
|
||||
equals(other: Entity<RatingEventId>): boolean {
|
||||
return this.id.equals(other.id);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Represents an achievement earned by a specific user.
|
||||
*/
|
||||
|
||||
import type { Entity } from '@core/shared/domain/Entity';
|
||||
import { Entity } from '@core/shared/domain/Entity';
|
||||
|
||||
export interface UserAchievementProps {
|
||||
id: string;
|
||||
@@ -15,8 +15,7 @@ export interface UserAchievementProps {
|
||||
progress?: number; // For partial progress tracking (0-100)
|
||||
}
|
||||
|
||||
export class UserAchievement implements Entity<string> {
|
||||
readonly id: string;
|
||||
export class UserAchievement extends Entity<string> {
|
||||
readonly userId: string;
|
||||
readonly achievementId: string;
|
||||
readonly earnedAt: Date;
|
||||
@@ -24,7 +23,8 @@ export class UserAchievement implements Entity<string> {
|
||||
readonly progress: number;
|
||||
|
||||
private constructor(props: UserAchievementProps) {
|
||||
this.id = props.id;
|
||||
super(props.id);
|
||||
|
||||
this.userId = props.userId;
|
||||
this.achievementId = props.achievementId;
|
||||
this.earnedAt = props.earnedAt;
|
||||
|
||||
Reference in New Issue
Block a user