Hi,
@MichelDiz
I am using dql and I have two types user and membership
membership has a predicate ofUser of type uid and I linked it to the user type.
I also added the reverse directive.
My questions are:
- will I be able to get the user from the membership and vice versa?
- What should I do in order to create a many to one relationship between user and membership - each user has many memberships but a membership belongs only to one user
- how would you implement this gql scheme in dql (using the reverse if necessary):
type Membership {
id: ID!
belongsTo: User! @hasInverse(field: memberships)
in: Repository! @hasInverse(field: activeMemberships)
role: Role! @search
}
type Repository {
id: ID!
name: String! @search(by: [regexp, exact])
description: String @search(by: [fulltext])
branches: [Branch!]
activeMemberships: [Membership!]!
isPublic: Boolean! @search
tags: [Hashtag!] @hasInverse(field: appearsOn)
createdAt: DateTime! @search(by: [month])
numOfStars: Int
visits: [RepositoryVisit!]
dataSource: IDataSource!
}
type User {
username: String! @search(by: [hash, regexp]) @id
name: String
email: String! @search(by: [hash, regexp])
memberships: [Membership!] @hasInverse(field: belongsTo)
hasCredentials: [Credentials!] @hasInverse(field: forUser)
visits: [UserVisit!]
joinedAt: DateTime @search(by: [month])
}