subsquid / squid-sdk

The main repo of the squid SDK
Apache License 2.0
1.23k stars 151 forks source link

Make OneToOne releations bi-directional #190

Closed belopash closed 7 months ago

eldargab commented 1 year ago

What is the case which bothered you enough to make a PR? :)

belopash commented 1 year ago

@eldargab missed the comment

type Account @entity {
    id: ID!
    publicKey: ID! @index
    stashOf: Staker @derivedFrom(field: "stash")
    controllerOf: Staker @derivedFrom(field: "controller")
}

type Staker @entity {
    id: ID!
    stash: Account! @unique
    controller: Account @unique

    ...
}

need to query account in code to get controllerOf relation

belopash commented 1 year ago

for now I patched it locally, so it's not urgent