דלגו לתוכן

מנויי רשומות פשוטים

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

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

מנוי להאזנה לרשומות טבלה שנוצרות.

mutation createSubscription($input: SubscriptionInput!) {
system {
createSubscription(input: $input) {
id
active
name
}
}
}
{
"input": {
"name": "students_create",
"description": "Subscription - students table, operation create",
"active": true,
"tables": [
{
"table": "students",
"operations": ["CREATE"],
"fields": ["id", "first_name", "email"]
}
]
}
}
{
"data": {
"system": {
"createSubscription": {
"id": "id_subscription",
"active": true,
"name": "students_create"
}
}
}
}

מנוי להאזנה לרשומות טבלה שמתעדכנות.

mutation updateSubscription ($input: SubscriptionInput!) {
system {
updateSubscription( input: $input ) {
id
name
description
}
}
}
{
"input": {
"id": "id_subscription",
"name": "students_create",
"description": "Subscription - students table, operation create",
"active": true,
"tables": [
{
"table": "students",
"operations": ["UPDATE", "CREATE", "DELETE"],
"fields": ["id", "first_name"]
}
]
}
}
{
"data": {
"system": {
"updateSubscription": {
"id": "id_subscription",
"name": "students_create",
"description": "Subscription - students table, operation create"
}
}
}
}

מנוי להאזנה לרשומות טבלה שנמחקות.

mutation deleteSubscription($id: String!) {
system {
deleteSubscription(id: $id)
}
}
{
"id": "id_subscription"
}
{
"data": {
"system": {
"deleteSubscription": true
}
}
}