Skip to content

Complex Record Subscriptions

In the following examples, we have a table called students, which contains fields and relations like id, firstName, email, age.

You can subscribe to individual and related records being created, updated, and deleted using Archie Core’s auto-generated GraphQL subscriptiong operation.

OperatorUsage Example
eqstatus = "active"
neqtype != "admin"
gtage > 18
ltprice < 100
gtescore >= 80
lteattempts <= 3
containsname contains "john"
startsWithemail startsWith "admin"
endsWithdomain endsWith ".com"
mutation createNewSubscription($input: SubscriptionInput!) {
system {
createSubscription(input: $input) {
id
active
name
}
}
}
{
"input": {
"name": "students_create_gte_lte",
"description": "Subscription - students table - create - gte lte",
"active": true,
"tables": [
{
"table": "students",
"operations": ["CREATE"],
"fields": ["id", "first_name", "email", "age"],
"conditions": [
{
"field": "age",
"operator": "GTE",
"value": "25"
},
{
"field": "age",
"operator": "LTE",
"value": "50"
}
]
}
]
}
}
{
"data": {
"system": {
"createSubscription": {
"id": "id_subscription",
"active": true,
"name": "students_create_gte_lte"
}
}
}
}
mutation createNewSubscription($input: SubscriptionInput!) {
system {
createSubscription(input: $input) {
id
active
name
}
}
}
{
"input": {
"name": "multiple_tables",
"description": "Subscription multiple tables",
"active": true,
"tables": [
{
"table": "students",
"operations": ["CREATE"],
"fields": ["id", "first_name", "email", "age"],
"conditions": [
{
"field": "age",
"operator": "GTE",
"value": "30"
},
{
"field": "age",
"operator": "LTE",
"value": "60"
}
]
},
{
"table": "courses",
"operations": ["UPDATE"],
"fields": ["id", "code", "name_course", "price"],
"conditions": [
{
"field": "price",
"operator": "LTE",
"value": "500"
}
]
}
]
}
}
{
"data": {
"system": {
"createSubscription": {
"id": "id_subscription",
"active": true,
"name": "multiple_tables"
}
}
}
}