This commit is contained in:
2025-12-12 01:11:36 +01:00
parent ec3ddc3a5c
commit 6a88fe93ab
125 changed files with 1513 additions and 803 deletions

View File

@@ -24,7 +24,7 @@ export interface GameConstraintsProps {
/**
* Game-specific constraints for popular sim racing games
*/
const GAME_CONSTRAINTS: Record<string, GameConstraintsData> = {
const GAME_CONSTRAINTS: Record<string, GameConstraintsData> & { default: GameConstraintsData } = {
iracing: {
maxDrivers: 64,
maxTeams: 32,
@@ -76,6 +76,15 @@ const GAME_CONSTRAINTS: Record<string, GameConstraintsData> = {
},
};
function getConstraintsForId(gameId: string): GameConstraintsData {
const lower = gameId.toLowerCase();
const fromMap = GAME_CONSTRAINTS[lower];
if (fromMap) {
return fromMap;
}
return GAME_CONSTRAINTS.default;
}
export class GameConstraints implements IValueObject<GameConstraintsProps> {
readonly gameId: string;
readonly constraints: GameConstraintsData;
@@ -100,8 +109,8 @@ export class GameConstraints implements IValueObject<GameConstraintsProps> {
* Get constraints for a specific game
*/
static forGame(gameId: string): GameConstraints {
const constraints = getConstraintsForId(gameId);
const lowerId = gameId.toLowerCase();
const constraints = GAME_CONSTRAINTS[lowerId] ?? GAME_CONSTRAINTS.default;
return new GameConstraints(lowerId, constraints);
}

View File

@@ -17,17 +17,17 @@ export interface SponsorshipSlotConfig {
}
export interface SponsorshipPricingProps {
mainSlot?: SponsorshipSlotConfig;
secondarySlots?: SponsorshipSlotConfig;
mainSlot?: SponsorshipSlotConfig | undefined;
secondarySlots?: SponsorshipSlotConfig | undefined;
acceptingApplications: boolean;
customRequirements?: string;
customRequirements?: string | undefined;
}
export class SponsorshipPricing implements IValueObject<SponsorshipPricingProps> {
readonly mainSlot?: SponsorshipSlotConfig;
readonly secondarySlots?: SponsorshipSlotConfig;
readonly mainSlot: SponsorshipSlotConfig | undefined;
readonly secondarySlots: SponsorshipSlotConfig | undefined;
readonly acceptingApplications: boolean;
readonly customRequirements?: string;
readonly customRequirements: string | undefined;
private constructor(props: SponsorshipPricingProps) {
this.mainSlot = props.mainSlot;
@@ -212,8 +212,10 @@ export class SponsorshipPricing implements IValueObject<SponsorshipPricingProps>
maxSlots: 1,
};
const base = this.props;
return new SponsorshipPricing({
...this,
...base,
mainSlot: {
...currentMain,
...config,
@@ -234,8 +236,10 @@ export class SponsorshipPricing implements IValueObject<SponsorshipPricingProps>
maxSlots: 2,
};
const base = this.props;
return new SponsorshipPricing({
...this,
...base,
secondarySlots: {
...currentSecondary,
...config,
@@ -248,8 +252,10 @@ export class SponsorshipPricing implements IValueObject<SponsorshipPricingProps>
* Enable/disable accepting applications
*/
setAcceptingApplications(accepting: boolean): SponsorshipPricing {
const base = this.props;
return new SponsorshipPricing({
...this,
...base,
acceptingApplications: accepting,
});
}