You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Summary: Model data that should only be able to happen once per user for a given target document or account (e.g. follow a user, like a post, etc).
Details:
SET account relation complements the SINGLE and LIST account relations by creating a new type of relation that must be unique per combination of account + field of document.
Use Cases
This allows to model relations such as friend requests, following, likes, etc. that are not unique per account + model combination as for the SINGLE relation, but unique per account + model + document field.
For example a friend request or following model would have a target did: DID! representing the unique value, or postID: StreamID! to represent a like.
This new type of account relation will allow to model social relations such as following and friend requests to target DIDs, as well as individual interactions with documents such as toggling favorites, votes and similar patterns.
SET account relation is needed for associating data to a user who is not the document owner.
# AddPostMetamodeltypePost @loadModel(id: "...") {}type PostMeta @createModel(accountRelation: SET, accountRelationField: "postID") { postID: StreamID! @documentReference(model: "Post") coverImage: URI!}# Add view to existing modeltype Post @loadModel(id: "...") { # This is a 0-1 relation with the account DID provided at runtime meta: PostMeta @accountRelationFrom(field: "postID")
}
When creating the document stream, the value of all the field defined in the set relation is set as the unique value of the stream metadata
When the stream gets updated, the field defined as the account relation should be treated as immutable and an error should be thrown if the client attempts any mutation of its value
New mutations and associated indexing logic would be needed to “remove”/unset the relation.
Summary: Model data that should only be able to happen once per user for a given target document or account (e.g. follow a user, like a post, etc).
Details:
SET account relation complements the
SINGLE
andLIST
account relations by creating a new type of relation that must be unique per combination of account + field of document.Use Cases
This allows to model relations such as friend requests, following, likes, etc. that are not unique per account + model combination as for the
SINGLE
relation, but unique per account + model + document field.For example a friend request or following model would have a target
did: DID!
representing the unique value, orpostID: StreamID!
to represent a like.This new type of account relation will allow to model social relations such as following and friend requests to target DIDs, as well as individual interactions with documents such as toggling favorites, votes and similar patterns.
SET account relation is needed for associating data to a user who is not the document owner.
GraphQL schema definition
Account to account
Account to document
Model definition
Stream handling logic
unique
value of the stream metadataGenerated GraphQL schema
Example queries
The text was updated successfully, but these errors were encountered: