Refactor LookupAuthorities method
All checks were successful
Build / build (pull_request) Successful in 3m12s
Integration Tests / test-integration (pull_request) Successful in 3m15s
E2E Tests / test-e2e (pull_request) Successful in 4m53s
Unit Tests / test-unit (pull_request) Successful in 2m10s
SDK Tests / sdk_tests (pull_request) Successful in 8m37s
SDK Tests / sdk_tests_auctions (pull_request) Successful in 14m19s
SDK Tests / sdk_tests_nameservice_expiry (pull_request) Successful in 7m6s
All checks were successful
Build / build (pull_request) Successful in 3m12s
Integration Tests / test-integration (pull_request) Successful in 3m15s
E2E Tests / test-e2e (pull_request) Successful in 4m53s
Unit Tests / test-unit (pull_request) Successful in 2m10s
SDK Tests / sdk_tests (pull_request) Successful in 8m37s
SDK Tests / sdk_tests_auctions (pull_request) Successful in 14m19s
SDK Tests / sdk_tests_nameservice_expiry (pull_request) Successful in 7m6s
This commit is contained in:
parent
8ccc21116e
commit
61a7c6e95f
@ -82,29 +82,11 @@ func (q queryResolver) LookupAuthorities(ctx context.Context, names []string) ([
|
||||
}
|
||||
|
||||
nameAuthority := res.GetNameAuthority()
|
||||
gqlNameAuthorityRecord, err := GetGQLNameAuthorityRecord(&nameAuthority)
|
||||
gqlNameAuthorityRecord, err := getAuthorityRecord(nameAuthority, auctionQueryClient)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if nameAuthority.AuctionId != "" {
|
||||
auctionResp, err := auctionQueryClient.GetAuction(context.Background(), &auctiontypes.QueryGetAuctionRequest{Id: nameAuthority.GetAuctionId()})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
bidsResp, err := auctionQueryClient.GetBids(context.Background(), &auctiontypes.QueryGetBidsRequest{AuctionId: nameAuthority.GetAuctionId()})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
gqlAuctionRecord, err := GetGQLAuction(auctionResp.GetAuction(), bidsResp.GetBids())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
gqlNameAuthorityRecord.Auction = gqlAuctionRecord
|
||||
}
|
||||
|
||||
gqlResponse = append(gqlResponse, gqlNameAuthorityRecord)
|
||||
}
|
||||
|
||||
|
@ -305,8 +305,6 @@ func toRPCAttributes(attrs []*KeyValueInput) []*registrytypes.QueryRecordsReques
|
||||
}
|
||||
|
||||
func getAuthorityRecord(nameAuthority registrytypes.NameAuthority, auctionQueryClient auctiontypes.QueryClient) (*AuthorityRecord, error) {
|
||||
gqlResponse := &AuthorityRecord{}
|
||||
|
||||
gqlNameAuthorityRecord, err := GetGQLNameAuthorityRecord(&nameAuthority)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -330,7 +328,5 @@ func getAuthorityRecord(nameAuthority registrytypes.NameAuthority, auctionQueryC
|
||||
gqlNameAuthorityRecord.Auction = gqlAuctionRecord
|
||||
}
|
||||
|
||||
*gqlResponse = *gqlNameAuthorityRecord
|
||||
|
||||
return gqlResponse, nil
|
||||
return gqlNameAuthorityRecord, nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user