Implement GQL query for listing authorities #48

Merged
nabarun merged 2 commits from deep-stack/laconicd:iv-list-authorities-gql-query into main 2024-08-02 09:15:09 +00:00
2 changed files with 2 additions and 24 deletions
Showing only changes of commit bfafdbcc41 - Show all commits

View File

@ -82,29 +82,11 @@ func (q queryResolver) LookupAuthorities(ctx context.Context, names []string) ([
} }
nameAuthority := res.GetNameAuthority() nameAuthority := res.GetNameAuthority()
gqlNameAuthorityRecord, err := GetGQLNameAuthorityRecord(&nameAuthority) gqlNameAuthorityRecord, err := getAuthorityRecord(nameAuthority, auctionQueryClient)
if err != nil { if err != nil {
return nil, err 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) gqlResponse = append(gqlResponse, gqlNameAuthorityRecord)
} }

View File

@ -305,8 +305,6 @@ func toRPCAttributes(attrs []*KeyValueInput) []*registrytypes.QueryRecordsReques
} }
func getAuthorityRecord(nameAuthority registrytypes.NameAuthority, auctionQueryClient auctiontypes.QueryClient) (*AuthorityRecord, error) { func getAuthorityRecord(nameAuthority registrytypes.NameAuthority, auctionQueryClient auctiontypes.QueryClient) (*AuthorityRecord, error) {
gqlResponse := &AuthorityRecord{}
gqlNameAuthorityRecord, err := GetGQLNameAuthorityRecord(&nameAuthority) gqlNameAuthorityRecord, err := GetGQLNameAuthorityRecord(&nameAuthority)
if err != nil { if err != nil {
return nil, err return nil, err
@ -330,7 +328,5 @@ func getAuthorityRecord(nameAuthority registrytypes.NameAuthority, auctionQueryC
gqlNameAuthorityRecord.Auction = gqlAuctionRecord gqlNameAuthorityRecord.Auction = gqlAuctionRecord
} }
*gqlResponse = *gqlNameAuthorityRecord return gqlNameAuthorityRecord, nil
return gqlResponse, nil
} }