const data: Prisma.ModuleUpdateInput = {
name: input.name,
description: input.description,
course: {
connect: {
id: input.course,
},
},
// Here is a one to many relation with Module <-* Lesson
lessons:
lessons.length > 0
? {
set: lessons.map((lessonId, index) => ({
id: lessonId,
// Adding this field don't works, only the first item is linked
order: index,
})),
}
: undefined,
}
const data: Prisma.ModuleUpdateInput = {
name: input.name,
description: input.description,
course: {
connect: {
id: input.course,
},
},
// Here is a one to many relation with Module <-* Lesson
lessons:
lessons.length > 0
? {
set: lessons.map((lessonId, index) => ({
id: lessonId,
// Adding this field don't works, only the first item is linked
order: index,
})),
}
: undefined,
}