דלגו לתוכן

מוטציות רשומות מרובות

ניתן ליצור רשומות טבלה מרובות באמצעות פעולות מוטציית GraphQL שנוצרות אוטומטית על ידי Archie Core.

בדוגמאות הבאות, יש לנו טבלה בשם students, המכילה שדות ויחסים כמו firstName, email ו-age.

בקשה

mutation MyMutation1 {
createStudentsMany(
inputs: [
{
firstName: "Michael",
lastName: "Jones",
email: "michael.jones@example.com" ,
age: 24
city: "2900562f-d036-486d-be98-9ebf064c27fe"
}
{
firstName: "William",
lastName: "Miller",
email: "william.miller@example.com" ,
age: 23
city: "fd880601-8732-4b1b-a42d-4170ef9cc485"
}
]
) {
success
}
}

תגובה

{
"data": {
"createStudentsMany": {
"success": true
}
}
}

יצירת רשומות מרובות באמצעות משתנים

Section titled “יצירת רשומות מרובות באמצעות משתנים”

בקשה

mutation MyMutation1 ( $inputs: [StudentsCreateInput!]!) {
createStudentsMany( inputs: $inputs ) {
success
}
}

משתנים

{
"inputs": [
{
"firstName": "Michael",
"lastName": "Jones",
"email": "michael.jones@example.com" ,
"age": 24,
"city": "2900562f-d036-486d-be98-9ebf064c27fe"
},
{
"firstName": "William",
"lastName": "Miller",
"email": "william.miller@example.com" ,
"age": 23,
"city": "fd880601-8732-4b1b-a42d-4170ef9cc485"
}
]
}

תגובה

{
"data": {
"createStudentsMany": {
"success": true
}
}
}