Add query teamBySlug #56

This commit is contained in:
Barry Low committed 2018-11-07 08:55:56 -08:00
1 parent 7fa1c21092
commit ba87853988
2 files changed
+5

No files matched your search

+4
View File
@@ -19,6 +19,10 @@ export const teamByName = async (parent, { name }, ctx, info) => {
return ctx.db.query.team({ where: { name: name } }, TEAMS_FRAGMENT)
}
export const teamBySlug= async (parent, { slug }, ctx, info) => {
return ctx.db.query.team({ where: { slug: slug } }, TEAMS_FRAGMENT)
}
export const teamWithRole = async (parent, { teamId, role }, ctx, info) => {
return ctx.db.query.teamsConnection({where: {AND: [{id: teamId},{members_some:{role: role}}]}, first:1}, info)
}
+1
View File
@@ -9,6 +9,7 @@ type Query {
teams: TeamConnection
teamDetails: [Team!]! @isAuthenticated
teamByName(name: String!): Team
teamBySlug(slug: String!): Team
teamById(teamId: String!): Team
teamWithRole(teamId: String!, role: String!): Team
teamsByOwner: [Team!]! @isAuthenticated