wip league admin tools

This commit is contained in:
2025-12-28 12:04:12 +01:00
parent 5dc8c2399c
commit 6edf12fda8
401 changed files with 15365 additions and 6047 deletions

View File

@@ -4,6 +4,7 @@ import { SponsorshipRequest } from '@core/racing/domain/entities/SponsorshipRequ
import { Season } from '@core/racing/domain/entities/season/Season';
import { SeasonSponsorship } from '@core/racing/domain/entities/season/SeasonSponsorship';
import type { Sponsor } from '@core/racing/domain/entities/sponsor/Sponsor';
import type { SeasonStatusValue } from '@core/racing/domain/value-objects/SeasonStatus';
import { Money } from '@core/racing/domain/value-objects/Money';
export class RacingSeasonSponsorshipFactory {
@@ -85,7 +86,7 @@ export class RacingSeasonSponsorshipFactory {
const id = `${leagueId}-season-${i + 1}`;
const isFirst = i === 0;
const status: Season['status'] =
const status: SeasonStatusValue =
leagueId === 'league-1' && isFirst
? 'active'
: leagueId === 'league-2'
@@ -133,7 +134,7 @@ export class RacingSeasonSponsorshipFactory {
const sponsorshipCount =
season.id === 'season-1'
? 2
: season.status === 'active'
: season.status.isActive()
? faker.number.int({ min: 0, max: 2 })
: faker.number.int({ min: 0, max: 1 });
@@ -162,12 +163,12 @@ export class RacingSeasonSponsorshipFactory {
),
createdAt: faker.date.recent({ days: 120, refDate: this.baseDate }),
description: tier === 'main' ? 'Main sponsor slot' : 'Secondary sponsor slot',
...(season.status === 'active'
...(season.status.isActive()
? {
status: faker.helpers.arrayElement(['active', 'pending'] as const),
activatedAt: faker.date.recent({ days: 30, refDate: this.baseDate }),
}
: season.status === 'completed' || season.status === 'archived'
: season.status.isCompleted() || season.status.isArchived()
? {
status: faker.helpers.arrayElement(['ended', 'cancelled'] as const),
endedAt: faker.date.recent({ days: 200, refDate: this.baseDate }),
@@ -191,7 +192,11 @@ export class RacingSeasonSponsorshipFactory {
for (const season of seasons) {
const isHighTrafficDemo = season.id === 'season-1';
const maxRequests =
isHighTrafficDemo ? 8 : season.status === 'active' ? faker.number.int({ min: 0, max: 4 }) : faker.number.int({ min: 0, max: 1 });
isHighTrafficDemo
? 8
: season.status.isActive()
? faker.number.int({ min: 0, max: 4 })
: faker.number.int({ min: 0, max: 1 });
for (let i = 0; i < maxRequests; i++) {
const tier: SponsorshipRequest['tier'] =
@@ -219,7 +224,7 @@ export class RacingSeasonSponsorshipFactory {
// A mix of statuses for edge cases (pending is what the UI lists)
const status =
season.status === 'active'
season.status.isActive()
? faker.helpers.arrayElement(['pending', 'pending', 'pending', 'rejected', 'withdrawn'] as const)
: faker.helpers.arrayElement(['pending', 'rejected'] as const);