diff --git a/src/graphql/operations/roles.ts b/src/graphql/operations/roles.ts index c6d99b5c..51af93c1 100644 --- a/src/graphql/operations/roles.ts +++ b/src/graphql/operations/roles.ts @@ -4,9 +4,7 @@ import log from '../../helpers/log'; export default async function (parent, args) { const { where = {} } = args; - const { address } = where; - if (!address) return Promise.reject(new Error('address is required')); const query = ` SELECT * FROM spaces diff --git a/src/graphql/operations/space.ts b/src/graphql/operations/space.ts index d976459e..53d3e6d5 100644 --- a/src/graphql/operations/space.ts +++ b/src/graphql/operations/space.ts @@ -3,7 +3,6 @@ import log from '../../helpers/log'; import { capture } from '@snapshot-labs/snapshot-sentry'; export default async function (_parent, { id }, context, info) { - if (!id) return new PublicError('Missing id'); try { let spaces = await fetchSpaces({ first: 1, where: { id } }); if (spaces.length !== 1) return null; diff --git a/src/graphql/operations/vote.ts b/src/graphql/operations/vote.ts index 5f99e20a..678e8d2a 100644 --- a/src/graphql/operations/vote.ts +++ b/src/graphql/operations/vote.ts @@ -1,10 +1,8 @@ import { capture } from '@snapshot-labs/snapshot-sentry'; -import { PublicError } from '../helpers'; import log from '../../helpers/log'; import fetchVotes from './votes'; export default async function (parent, { id }, context, info) { - if (!id) return new PublicError('Missing id'); try { const votes = await fetchVotes( parent, diff --git a/src/graphql/schema.gql b/src/graphql/schema.gql index fa99248f..34652331 100644 --- a/src/graphql/schema.gql +++ b/src/graphql/schema.gql @@ -3,7 +3,7 @@ scalar Any # Queries type Query { - space(id: String): Space + space(id: String!): Space spaces( first: Int! = 20 @@ -15,7 +15,7 @@ type Query { ranking(first: Int! = 20, skip: Int! = 0, where: RankingWhere): RankingObject - proposal(id: String): Proposal + proposal(id: String!): Proposal proposals( first: Int! = 20 @@ -25,7 +25,7 @@ type Query { orderDirection: OrderDirection ): [Proposal] - vote(id: String): Vote + vote(id: String!): Vote votes( first: Int! = 20 @@ -43,7 +43,7 @@ type Query { orderDirection: OrderDirection ): [Alias] - roles(where: RolesWhere): [Role] + roles(where: RolesWhere!): [Role] follows( first: Int! = 20 @@ -77,9 +77,9 @@ type Query { orderDirection: OrderDirection ): [Statement] - user(id: String): User + user(id: String!): User - statement(id: String): Statement + statement(id: String!): Statement skins: [Item] @@ -91,7 +91,7 @@ type Query { strategies: [StrategyItem] - strategy(id: String): StrategyItem + strategy(id: String!): StrategyItem vp(voter: String!, space: String!, proposal: String): Vp @@ -264,7 +264,7 @@ input AliasWhere { } input RolesWhere { - address: String + address: String! } input FollowWhere {