Daniel Sieradski
07/16/2021, 3:37 PMRyan
07/19/2021, 6:20 AMDaniel Sieradski
07/19/2021, 2:38 PMPrismaClientValidationError:
Invalid `prisma.utterances.create()` invocation:
{
data: {
uid: 'eebb1696-667f-4523-9e72-7356a6df367c',
name: 'hello',
description: 'say hello!',
keyword: 'hello',
variants: [
{
uid: 'f8f0243b-3a49-4deb-b041-ebefecafe407',
dialog: 'Hello and welcome to Zombo com',
variant_type: 1,
parent: 0,
priority: 0,
status: 'LIVE',
variant_channels: [
{
channel_id: 1
}
]
}
]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
}
}
Argument variants: Got invalid value
[
{
uid: 'f8f0243b-3a49-4deb-b041-ebefecafe407',
dialog: 'Hello and welcome to Zombo com',
variant_type: 1,
parent: 0,
priority: 0,
status: 'LIVE',
variant_channels: [
{
channel_id: 1
}
]
}
]
on prisma.createOneutterances. Provided List<Json>, expected variantsCreateNestedManyWithoutUtterancesInput:
type variantsCreateNestedManyWithoutUtterancesInput {
create?: variantsCreateWithoutUtterancesInput | List<variantsCreateWithoutUtterancesInput> | variantsUncheckedCreateWithoutUtterancesInput | List<variantsUncheckedCreateWithoutUtterancesInput>
connectOrCreate?: variantsCreateOrConnectWithoutUtterancesInput | List<variantsCreateOrConnectWithoutUtterancesInput>
createMany?: variantsCreateManyUtterancesInputEnvelope
connect?: variantsWhereUniqueInput | List<variantsWhereUniqueInput>
}
at Document.validate (/home/dsieradski/code/dialog-api-mock-server/node_modules/@prisma/client/runtime/index.js:33530:19)
at NewPrismaClient._executeRequest (/home/dsieradski/code/dialog-api-mock-server/node_modules/@prisma/client/runtime/index.js:35637:17)
at consumer (/home/dsieradski/code/dialog-api-mock-server/node_modules/@prisma/client/runtime/index.js:35582:23)
at /home/dsieradski/code/dialog-api-mock-server/node_modules/@prisma/client/runtime/index.js:35584:47
at AsyncResource.runInAsyncScope (async_hooks.js:197:9)
at NewPrismaClient._request (/home/dsieradski/code/dialog-api-mock-server/node_modules/@prisma/client/runtime/index.js:35584:25)
at Object.then (/home/dsieradski/code/dialog-api-mock-server/node_modules/@prisma/client/runtime/index.js:35692:39)
at processTicksAndRejections (internal/process/task_queues.js:95:5) {
clientVersion: '2.27.0'
}
Daniel Sieradski
07/19/2021, 2:38 PMDaniel Sieradski
07/19/2021, 2:41 PMmutation CreateUtterance($utterance: UtteranceIn) {
utteranceCreate(utterance: $utterance) {
uid
name
description
keyword
variants {
uid
dialog
priority
status
parent
variant_channels {
channel_id
}
}
}
}
vars:
{
"utterance": {
"uid": "eebb1696-667f-4523-9e72-7356a6df367c",
"name": "hello",
"description": "say hello!",
"keyword": "hello",
"variants": [
{
"uid": "f8f0243b-3a49-4deb-b041-ebefecafe407",
"dialog": "Hello and welcome to Zombo com",
"variant_type": 1,
"priority": 0,
"status": "LIVE",
"parent": 0,
"variant_channels": {
"channel_id": 1
}
}
]
}
}
Ryan
07/19/2021, 2:48 PMcreate
if you want to create a variant. Check the doc I sent you above for the example.Daniel Sieradski
07/19/2021, 2:59 PMDaniel Sieradski
07/19/2021, 2:59 PMDaniel Sieradski
07/19/2021, 3:03 PMimport { utterances as Utterance, PrismaClient, Prisma } from '.prisma/client/index.d'
export default (prisma: PrismaClient) =>
async (parent: undefined, args: Prisma.utterancesCreateInput): Promise<Utterance | null | undefined> => {
try {
const { utterance } = args
return await prisma.utterances.create({ data: utterance })
} catch (error) {
console.error(error)
}
}
Daniel Sieradski
07/19/2021, 3:04 PMRyan
07/19/2021, 4:06 PMschema.prisma
then I can point you to the exact query to be made.Daniel Sieradski
07/19/2021, 8:11 PMDaniel Sieradski
07/19/2021, 8:19 PMRyan
08/12/2021, 6:28 AM