wip
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user