From d04f706ef13faab9e7517035757185791aab14f8 Mon Sep 17 00:00:00 2001 From: Rico Date: Tue, 13 Sep 2022 12:16:28 +0800 Subject: [PATCH] graphql-server: Softcast proposal type refs #362 --- graphql-schema/proposal.graphql | 2 +- graphql-server/pkg/resolvers/proposal.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/graphql-schema/proposal.graphql b/graphql-schema/proposal.graphql index 1d11dad3..4d5d0197 100644 --- a/graphql-schema/proposal.graphql +++ b/graphql-schema/proposal.graphql @@ -35,7 +35,7 @@ type Proposal implements Node { proposalId: Int! title: String! description: String! - type: ProposalType! + type: String! submitTime: DateTime! depositEndTime: DateTime "Sum of all deposit in chain's coin denom (non chain's coin denom deposits excluded)" diff --git a/graphql-server/pkg/resolvers/proposal.go b/graphql-server/pkg/resolvers/proposal.go index 7268d2ce..8bf7d78d 100644 --- a/graphql-server/pkg/resolvers/proposal.go +++ b/graphql-server/pkg/resolvers/proposal.go @@ -20,14 +20,14 @@ func (r *proposalResolver) ProposalID(ctx context.Context, obj *models.Proposal) return obj.ID, nil } -func (r *proposalResolver) Type(ctx context.Context, obj *models.Proposal) (models.ProposalType, error) { +func (r *proposalResolver) Type(ctx context.Context, obj *models.Proposal) (string, error) { proposalType := new(models.ProposalType) err := proposalType.UnmarshalGQL(obj.ProposalType) if err != nil { - return "", nil + return obj.ProposalType, nil } - return *proposalType, nil + return proposalType.String(), nil } func (r *proposalResolver) DepositTotal(ctx context.Context, obj *models.Proposal) ([]types.DbDecCoin, error) {