fix: update recurringGroupId assignment and improve type definitions in helpers
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import { db } from '@/lib/prisma';
|
||||
import { buildUniqueSlug, slugify } from '@/lib/slug';
|
||||
import { ensureActiveSport } from '@/modules/court/shared/guards';
|
||||
import type { CreateComplexInput } from '@repo/api-contract';
|
||||
import { v7 as uuidv7 } from 'uuid';
|
||||
|
||||
@@ -65,7 +64,15 @@ export async function createComplex(input: CreateComplexInternalInput) {
|
||||
}
|
||||
|
||||
if (input.setupCourts && input.courtSportId) {
|
||||
const sport = await ensureActiveSport(input.courtSportId);
|
||||
const sport = await tx.sport.findFirst({
|
||||
where: { id: input.courtSportId, isActive: true },
|
||||
select: { name: true },
|
||||
});
|
||||
|
||||
if (!sport) {
|
||||
throw new Error('El deporte seleccionado no existe o esta inactivo.');
|
||||
}
|
||||
|
||||
const availability = (input.courtDaysOfWeek ?? []).map((day) => ({
|
||||
dayOfWeek: day as DayOfWeek,
|
||||
startTime: input.courtStartTime ?? '08:00',
|
||||
|
||||
Reference in New Issue
Block a user