Add funds released flag in GQL schema
Some checks failed
Protobuf / lint (pull_request) Successful in 13s
Integration Tests / test-integration (pull_request) Successful in 2m38s
Build / build (pull_request) Successful in 2m55s
E2E Tests / test-e2e (pull_request) Successful in 4m10s
Unit Tests / test-unit (pull_request) Successful in 2m11s
SDK Tests / sdk_tests_authority_auctions (pull_request) Failing after 6m25s
SDK Tests / sdk_tests_nameservice_expiry (pull_request) Successful in 7m55s
SDK Tests / sdk_tests (pull_request) Failing after 9m37s

This commit is contained in:
Prathamesh Musale 2024-09-24 12:34:39 +05:30
parent 40ece271d0
commit e5f27c246c
4 changed files with 66 additions and 0 deletions

View File

@ -174,6 +174,7 @@ type Auction {
maxPrice: Coin! # Max bid amount for service provider auction. maxPrice: Coin! # Max bid amount for service provider auction.
kind: String! # Auction kind. kind: String! # Auction kind.
numProviders: Int # Number of service providers numProviders: Int # Number of service providers
fundsReleased: Boolean! # Whether funds have been released to providers
bids: [AuctionBid!]! # Bids made in the auction. bids: [AuctionBid!]! # Bids made in the auction.
} }

View File

@ -65,6 +65,7 @@ type ComplexityRoot struct {
CommitFee func(childComplexity int) int CommitFee func(childComplexity int) int
CommitsEndTime func(childComplexity int) int CommitsEndTime func(childComplexity int) int
CreateTime func(childComplexity int) int CreateTime func(childComplexity int) int
FundsReleased func(childComplexity int) int
ID func(childComplexity int) int ID func(childComplexity int) int
Kind func(childComplexity int) int Kind func(childComplexity int) int
MaxPrice func(childComplexity int) int MaxPrice func(childComplexity int) int
@ -349,6 +350,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in
return e.complexity.Auction.CreateTime(childComplexity), true return e.complexity.Auction.CreateTime(childComplexity), true
case "Auction.fundsReleased":
if e.complexity.Auction.FundsReleased == nil {
break
}
return e.complexity.Auction.FundsReleased(childComplexity), true
case "Auction.id": case "Auction.id":
if e.complexity.Auction.ID == nil { if e.complexity.Auction.ID == nil {
break break
@ -2450,6 +2458,50 @@ func (ec *executionContext) fieldContext_Auction_numProviders(ctx context.Contex
return fc, nil return fc, nil
} }
func (ec *executionContext) _Auction_fundsReleased(ctx context.Context, field graphql.CollectedField, obj *Auction) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_Auction_fundsReleased(ctx, field)
if err != nil {
return graphql.Null
}
ctx = graphql.WithFieldContext(ctx, fc)
defer func() {
if r := recover(); r != nil {
ec.Error(ctx, ec.Recover(ctx, r))
ret = graphql.Null
}
}()
resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) {
ctx = rctx // use context from middleware stack in children
return obj.FundsReleased, nil
})
if err != nil {
ec.Error(ctx, err)
return graphql.Null
}
if resTmp == nil {
if !graphql.HasFieldError(ctx, fc) {
ec.Errorf(ctx, "must not be null")
}
return graphql.Null
}
res := resTmp.(bool)
fc.Result = res
return ec.marshalNBoolean2bool(ctx, field.Selections, res)
}
func (ec *executionContext) fieldContext_Auction_fundsReleased(ctx context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) {
fc = &graphql.FieldContext{
Object: "Auction",
Field: field,
IsMethod: false,
IsResolver: false,
Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) {
return nil, errors.New("field of type Boolean does not have child fields")
},
}
return fc, nil
}
func (ec *executionContext) _Auction_bids(ctx context.Context, field graphql.CollectedField, obj *Auction) (ret graphql.Marshaler) { func (ec *executionContext) _Auction_bids(ctx context.Context, field graphql.CollectedField, obj *Auction) (ret graphql.Marshaler) {
fc, err := ec.fieldContext_Auction_bids(ctx, field) fc, err := ec.fieldContext_Auction_bids(ctx, field)
if err != nil { if err != nil {
@ -3316,6 +3368,8 @@ func (ec *executionContext) fieldContext_AuthorityRecord_auction(ctx context.Con
return ec.fieldContext_Auction_kind(ctx, field) return ec.fieldContext_Auction_kind(ctx, field)
case "numProviders": case "numProviders":
return ec.fieldContext_Auction_numProviders(ctx, field) return ec.fieldContext_Auction_numProviders(ctx, field)
case "fundsReleased":
return ec.fieldContext_Auction_fundsReleased(ctx, field)
case "bids": case "bids":
return ec.fieldContext_Auction_bids(ctx, field) return ec.fieldContext_Auction_bids(ctx, field)
} }
@ -5309,6 +5363,8 @@ func (ec *executionContext) fieldContext_Query_getAuctionsByIds(ctx context.Cont
return ec.fieldContext_Auction_kind(ctx, field) return ec.fieldContext_Auction_kind(ctx, field)
case "numProviders": case "numProviders":
return ec.fieldContext_Auction_numProviders(ctx, field) return ec.fieldContext_Auction_numProviders(ctx, field)
case "fundsReleased":
return ec.fieldContext_Auction_fundsReleased(ctx, field)
case "bids": case "bids":
return ec.fieldContext_Auction_bids(ctx, field) return ec.fieldContext_Auction_bids(ctx, field)
} }
@ -8923,6 +8979,13 @@ func (ec *executionContext) _Auction(ctx context.Context, sel ast.SelectionSet,
out.Values[i] = ec._Auction_numProviders(ctx, field, obj) out.Values[i] = ec._Auction_numProviders(ctx, field, obj)
case "fundsReleased":
out.Values[i] = ec._Auction_fundsReleased(ctx, field, obj)
if out.Values[i] == graphql.Null {
invalids++
}
case "bids": case "bids":
out.Values[i] = ec._Auction_bids(ctx, field, obj) out.Values[i] = ec._Auction_bids(ctx, field, obj)

View File

@ -41,6 +41,7 @@ type Auction struct {
MaxPrice *Coin `json:"maxPrice"` MaxPrice *Coin `json:"maxPrice"`
Kind string `json:"kind"` Kind string `json:"kind"`
NumProviders *int `json:"numProviders"` NumProviders *int `json:"numProviders"`
FundsReleased bool `json:"fundsReleased"`
Bids []*AuctionBid `json:"bids"` Bids []*AuctionBid `json:"bids"`
} }

View File

@ -250,6 +250,7 @@ func GetGQLAuction(auction *auctiontypes.Auction, bids []*auctiontypes.Bid) (*Au
MaxPrice: getGQLCoin(auction.MaxPrice), MaxPrice: getGQLCoin(auction.MaxPrice),
Kind: auction.Kind, Kind: auction.Kind,
NumProviders: &numProviders, NumProviders: &numProviders,
FundsReleased: auction.FundsReleased,
} }
auctionBids := make([]*AuctionBid, len(bids)) auctionBids := make([]*AuctionBid, len(bids))