Add fbByFbId query
This commit is contained in:
1 parent
766ed5e8ef
commit
69329ee1d0
4 files changed
+31
-2
No files matched your search
@@ -0,0 +1,16 @@
|
||||
import gql from 'graphql-tag'
|
||||
|
||||
const FB_FRAGMENT = gql`{
|
||||
id
|
||||
name
|
||||
slug
|
||||
avatar
|
||||
kind
|
||||
status {
|
||||
status
|
||||
reason
|
||||
createdAt
|
||||
}
|
||||
}`
|
||||
|
||||
module.exports = FB_FRAGMENT
|
||||
@@ -0,0 +1,10 @@
|
||||
import { logger } from '../../../logger'
|
||||
|
||||
import FB_FRAGMENT from '../../fragments/FBFragment'
|
||||
|
||||
export const fbByFbId = async (parent, { fbId }, ctx, info) => {
|
||||
logger.info(`fbByFbId: ${fbId}`)
|
||||
let FB = await ctx.db.query.financialBeings({where: {id: fbId}}, FB_FRAGMENT)
|
||||
logger.info(`fbByFbId response: ${JSON.stringify(await FB)}`)
|
||||
return FB
|
||||
}
|
||||
@@ -3,6 +3,7 @@ import { logger } from '../../../logger'
|
||||
import { member, owner } from './Member'
|
||||
import { teams, teamById, teamsByIds, teamByName, teamBySlug, teamWithRole, teamAuthorization, teamsByOwner, teamsByRole } from './Team'
|
||||
import{ fbByTeamMember } from './TeamMember'
|
||||
import{ fbByFbId } from './FinancialBeing'
|
||||
|
||||
export const resolvers = {
|
||||
Query: {
|
||||
@@ -17,6 +18,7 @@ export const resolvers = {
|
||||
teamsByOwner: (parent, arg, ctx, info) => teamsByOwner(parent, arg, ctx, info),
|
||||
teamsByRole: (parent, arg, ctx, info) => teamsByRole(parent, arg, ctx, info),
|
||||
owner: (parent, arg, ctx, info) => owner(parent, arg, ctx, info),
|
||||
fbByTeamMember: (parent, arg, ctx, info) => fbByTeamMember(parent, arg, ctx, info)
|
||||
fbByTeamMember: (parent, arg, ctx, info) => fbByTeamMember(parent, arg, ctx, info),
|
||||
fbByFbId: (parent, arg, ctx, info) => fbByFbId(parent, arg, ctx, info)
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
# import Query.TeamConnection, Team from "../generated/prisma.graphql"
|
||||
# import Query.TeamConnection, Team, FinancialBeings from "../generated/prisma.graphql"
|
||||
|
||||
directive @isAuthenticated on QUERY | FIELD | MUTATION | FIELD_DEFINITION
|
||||
directive @hasRole(roles: [String]) on QUERY | FIELD | MUTATION | FIELD_DEFINITION
|
||||
@@ -17,6 +17,7 @@ type Query {
|
||||
teamsByOwner: [Team!]! @isAuthenticated
|
||||
teamsByRole: [Team!]! @isAuthenticated
|
||||
fbByTeamMember: Team @isAuthenticated
|
||||
fbByFbId(fbId: String!): FinancialBeings
|
||||
owner: Member @isAuthenticated
|
||||
member: Member @isAuthenticated
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user