adding username translation

This commit is contained in:
Laurent Le Houerou 2021-12-22 11:33:19 +04:00
parent 3887d1299d
commit dc4a3693e8
2 changed files with 1 additions and 6 deletions

2
nft.go
View File

@ -207,7 +207,6 @@ func (s *MarketService) GetNft(ctx context.Context, collection string, tokenId i
res.IsRecent = time.Unix(res.UpdatedAt, 0).After(time.Now().Add(-1 * time.Hour))
res.IsVeryRecent = time.Unix(res.UpdatedAt, 0).After(time.Now().Add(-5 * time.Minute))
res.IsNotMine = res.CurrentSeller != s.bscaddress
res.CurrentSellerUsername = s.profileService.GetUsername(res.CurrentSeller)
return res, nil
}
@ -269,7 +268,6 @@ func (s *MarketService) getPage(ctx context.Context, collection string, pagenum
floor = nft.CurrentAskPrice
}
nft.IsNotMine = nft.CurrentSeller != s.bscaddress
nft.CurrentSellerUsername = s.profileService.GetUsername(nft.CurrentSeller)
res = append(res, nft)
}

View File

@ -110,8 +110,7 @@ func (s *TransactionService) GetLightPageByLimit(ctx context.Context, pagenumber
return transaction.Nft.TransactionHistory[i].Timestamp > transaction.Nft.TransactionHistory[j].Timestamp
})
transaction.IsMine = transaction.Buyer.Address == s.bscaddress || transaction.Seller.Address == s.bscaddress
transaction.SellerUsername = s.profileService.GetUsername(transaction.Seller.Address)
transaction.BuyerUsername = s.profileService.GetUsername(transaction.Buyer.Address)
}
var res []Transaction
@ -171,8 +170,6 @@ func (s *TransactionService) GetPageByLimit(ctx context.Context, pagenumber int,
transaction.Time = time.Unix(transaction.Timestamp, 0)
transaction.TimeDescription = humanize.Time(transaction.Time)
transaction.SellerUsername = s.profileService.GetUsername(transaction.Seller.Address)
transaction.BuyerUsername = s.profileService.GetUsername(transaction.Buyer.Address)
}
var res []Transaction