This commit is contained in:
2025-12-11 11:25:22 +01:00
parent 6a427eab57
commit e4c1be628d
86 changed files with 1222 additions and 736 deletions

View File

@@ -3,6 +3,8 @@
* Represents membership fee configuration for league drivers
*/
import { RacingDomainValidationError } from '../errors/RacingDomainError';
import type { Money } from './Money';
export type MembershipFeeType = 'season' | 'monthly' | 'per_race';
@@ -23,15 +25,15 @@ export class MembershipFee {
static create(type: MembershipFeeType, amount: Money): MembershipFee {
if (!type) {
throw new Error('MembershipFee type is required');
throw new RacingDomainValidationError('MembershipFee type is required');
}
if (!amount) {
throw new Error('MembershipFee amount is required');
throw new RacingDomainValidationError('MembershipFee amount is required');
}
if (amount.amount < 0) {
throw new Error('MembershipFee amount cannot be negative');
throw new RacingDomainValidationError('MembershipFee amount cannot be negative');
}
return new MembershipFee({ type, amount });