1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00
Jamie Hewitt 81341cd914
Showing related assets (#1748)
* Creating related assets component

* Ensuring that related assets doesn't show the same asset

* Adjusting query to show assets from the same publisher but not the exact same asset

* modifying search term

* Removing logs and unused import

* Removing log

* Updating query

* Fixes

* updating query

* Updating query to include both related tag assets anbd related owner assests when <3. SHowing results as a list of links

* creating minimal asset teaser

* removing duplicate filters

* Changing minimal to noDescription

* Removing unneccessary use of noDescription prop

* Adding minimal prop back into Publisher

* Removing props from RelatedAssets component

* Getting data from asset context

* refactor

* space-saving asset teaser changes
* remove price from output
* increase to 4
* refactor for better loading experience

* css cleanup

* filter out duplicates when merging results

* basic render test

* try/catch, secure against null query responses

* different test tactic

Co-authored-by: Matthias Kretschmann <m@kretschmann.io>
2022-11-07 20:09:19 +00:00

34 lines
678 B
TypeScript

import { SortTermOptions } from '../../../@types/aquarius/SearchQuery'
export function generateQuery(
chainIds: number[],
nftAddress: string,
size: number,
tags?: string[],
owner?: string
) {
return {
chainIds,
esPaginationOptions: {
size
},
nestedQuery: {
must_not: {
term: { 'nftAddress.keyword': nftAddress }
}
},
filters: [
tags && {
terms: { 'metadata.tags.keyword': tags }
},
owner && { term: { 'nft.owner.keyword': owner } }
],
sort: {
'stats.orders': 'desc'
},
sortOptions: {
sortBy: SortTermOptions.Orders
} as SortOptions
} as BaseQueryParams
}