From ba87853988a367af772da677cea987c3c2b57c98 Mon Sep 17 00:00:00 2001 From: Barry Low Date: Wed, 7 Nov 2018 08:55:56 -0800 Subject: [PATCH] Add query teamBySlug #56 --- api/src/graphql/resolvers/Query/Team.js | 4 ++++ api/src/graphql/schema.graphql | 1 + 2 files changed, 5 insertions(+) diff --git a/api/src/graphql/resolvers/Query/Team.js b/api/src/graphql/resolvers/Query/Team.js index 295375ca3..100980423 100644 --- a/api/src/graphql/resolvers/Query/Team.js +++ b/api/src/graphql/resolvers/Query/Team.js @@ -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) } diff --git a/api/src/graphql/schema.graphql b/api/src/graphql/schema.graphql index 2095882bb..54559651e 100644 --- a/api/src/graphql/schema.graphql +++ b/api/src/graphql/schema.graphql @@ -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