我遵循以下架构,并希望将一个数据记录Time
保存到UserTimerRecord.timeIds
中。我想将以下每个数据记录Time
推入UserTimeRecords.timeIds
type UserTimeRecord {
id: ID! @id
timeIds: [Time]
userId: ID! @userId
createdAt: DateTime @createdAt
}
type Time {
id: ID! @id
type: String!
time: DateTime! @createdAt
}
async setTime (_, { type }, context) {
const userId = getUserId(context)
const time = await prisma.createTime({ type })
if (type === 'start') {
await prisma.createUserTimeRecord({
userId,
timeIds: [time]
})
}
return time
}
}
我遇到了错误Reason: 'timeIds' Expected 'TimeCreateManyInput', found not an object.
答案 0 :(得分:0)
您可以使用Environment.TEST
create