Hi everyone, i’m using dgraph to build a dashboard.
I’m trying to import various domain alerts with an upsert.
The idea is to have unique DomainAlert using a unique combined key (domain + week)
after the first insertion, i can’t enter anymore DomainAlert. i get no errors, just
{
"addDomainAlert": null
}
Please find the schema and the request tested below. If anyone can help me
------- gql schema ---------
type DomainAlert {
domain: String! @search(by: [exact]) @id
week: Int! @id
date: DateTime!
rate: Int
domainExpiration: DateTime
domainExpirationWeek: Int
sslExpiration: DateTime
sslExpirationWeek: Int
alerts: [Alert] @hasInverse(field: "domain")
}
type Alert {
domain: DomainAlert!
source: String
url: String
title: String!
description: String
status: String @search
}
------- gql schema ---------
simple upsert does nothing
mutation addDomainAlert {
addDomainAlert(input: {domain: "www.oferhitech.com", date: "14-07-2021", week: 28}) {
domainAlert {
domain
}
}
}
return
{
"addDomainAlert": null
}
or upsert with variables
query:
mutation UpsertDomainAlert($input: [AddDomainAlertInput!]!) {
addDomainAlert(input: $input, upsert: true) {
numUids
}
}
variables:
{
"input": {
"rate": 0,
"domain": "www.oferhitech.com",
"date": "2021-07-14T17:27:15.757311+02:00",
"week": 28,
"domainExpiration": "0001-01-01T00:00:00Z",
"domainExpirationWeek": 0,
"sslExpiration": "2021-11-13T00:00:00Z",
"sslExpirationWeek": 45
}
}
return
{
"addDomainAlert": null
}