website refactor
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
* Aggregate root for managing league finances and transactions.
|
||||
*/
|
||||
|
||||
import type { Entity } from '@core/shared/domain/Entity';
|
||||
import { Entity } from '@core/shared/domain/Entity';
|
||||
import { RacingDomainInvariantError, RacingDomainValidationError } from '../../errors/RacingDomainError';
|
||||
|
||||
import type { Money } from '../../value-objects/Money';
|
||||
@@ -21,15 +21,15 @@ export interface LeagueWalletProps {
|
||||
createdAt: Date;
|
||||
}
|
||||
|
||||
export class LeagueWallet implements Entity<LeagueWalletId> {
|
||||
readonly id: LeagueWalletId;
|
||||
export class LeagueWallet extends Entity<LeagueWalletId> {
|
||||
readonly leagueId: LeagueId;
|
||||
readonly balance: Money;
|
||||
readonly transactionIds: TransactionId[];
|
||||
readonly createdAt: Date;
|
||||
|
||||
private constructor(props: LeagueWalletProps) {
|
||||
this.id = props.id;
|
||||
super(props.id);
|
||||
|
||||
this.leagueId = props.leagueId;
|
||||
this.balance = props.balance;
|
||||
this.transactionIds = props.transactionIds;
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
import { RacingDomainInvariantError, RacingDomainValidationError } from '../../errors/RacingDomainError';
|
||||
|
||||
import type { Entity } from '@core/shared/domain/Entity';
|
||||
import { Entity } from '@core/shared/domain/Entity';
|
||||
import type { Money } from '../../value-objects/Money';
|
||||
import { LeagueWalletId } from './LeagueWalletId';
|
||||
import { TransactionId } from './TransactionId';
|
||||
@@ -34,8 +34,7 @@ export interface TransactionProps {
|
||||
metadata: Record<string, unknown> | undefined;
|
||||
}
|
||||
|
||||
export class Transaction implements Entity<TransactionId> {
|
||||
readonly id: TransactionId;
|
||||
export class Transaction extends Entity<TransactionId> {
|
||||
readonly walletId: LeagueWalletId;
|
||||
readonly type: TransactionType;
|
||||
readonly amount: Money;
|
||||
@@ -48,7 +47,8 @@ export class Transaction implements Entity<TransactionId> {
|
||||
readonly metadata: Record<string, unknown> | undefined;
|
||||
|
||||
private constructor(props: TransactionProps) {
|
||||
this.id = props.id;
|
||||
super(props.id);
|
||||
|
||||
this.walletId = props.walletId;
|
||||
this.type = props.type;
|
||||
this.amount = props.amount;
|
||||
|
||||
Reference in New Issue
Block a user