This commit is contained in:
2025-12-10 18:28:32 +01:00
parent 6d61be9c51
commit 1303a14493
108 changed files with 3366 additions and 1559 deletions

View File

@@ -4,7 +4,8 @@ import {
type LeagueScheduleDTO,
type LeagueSchedulePreviewDTO,
} from '@gridpilot/racing/application';
import { getPreviewLeagueScheduleQuery } from '@/lib/di-container';
import { getPreviewLeagueScheduleUseCase } from '@/lib/di-container';
import { LeagueSchedulePreviewPresenter } from '@/lib/presenters/LeagueSchedulePreviewPresenter';
interface RequestBody {
seasonStartDate?: string;
@@ -73,11 +74,16 @@ export async function POST(request: NextRequest) {
const schedule = toLeagueScheduleDTO(json);
const query = getPreviewLeagueScheduleQuery();
const preview: LeagueSchedulePreviewDTO = await query.execute({
const presenter = new LeagueSchedulePreviewPresenter();
const useCase = getPreviewLeagueScheduleUseCase();
useCase.execute({
schedule,
maxRounds: 10,
});
const preview = presenter.getData();
if (!preview) {
return NextResponse.json({ error: 'Failed to generate preview' }, { status: 500 });
}
return NextResponse.json(preview, { status: 200 });
} catch (error) {

View File

@@ -1,7 +1,8 @@
import { NextResponse } from 'next/server';
import type { NextRequest } from 'next/server';
import { cookies } from 'next/headers';
import { getGetSponsorDashboardQuery } from '@/lib/di-container';
import { getGetSponsorDashboardUseCase } from '@/lib/di-container';
import { SponsorDashboardPresenter } from '@/lib/presenters/SponsorDashboardPresenter';
export async function GET(request: NextRequest) {
try {
@@ -16,8 +17,10 @@ export async function GET(request: NextRequest) {
);
}
const query = getGetSponsorDashboardQuery();
const dashboard = await query.execute({ sponsorId });
const presenter = new SponsorDashboardPresenter();
const useCase = getGetSponsorDashboardUseCase();
await useCase.execute({ sponsorId });
const dashboard = presenter.getData();
if (!dashboard) {
return NextResponse.json(

View File

@@ -1,7 +1,8 @@
import { NextResponse } from 'next/server';
import type { NextRequest } from 'next/server';
import { cookies } from 'next/headers';
import { getGetSponsorSponsorshipsQuery } from '@/lib/di-container';
import { getGetSponsorSponsorshipsUseCase } from '@/lib/di-container';
import { SponsorSponsorshipsPresenter } from '@/lib/presenters/SponsorSponsorshipsPresenter';
export async function GET(request: NextRequest) {
try {
@@ -16,8 +17,10 @@ export async function GET(request: NextRequest) {
);
}
const query = getGetSponsorSponsorshipsQuery();
const sponsorships = await query.execute({ sponsorId });
const presenter = new SponsorSponsorshipsPresenter();
const useCase = getGetSponsorSponsorshipsUseCase();
await useCase.execute({ sponsorId });
const sponsorships = presenter.getData();
if (!sponsorships) {
return NextResponse.json(