Skip to content

Commit

Permalink
Merge pull request #123 from kodadot/main
Browse files Browse the repository at this point in the history
🔖  Speck v5.1.2
  • Loading branch information
vikiival authored Oct 18, 2023
2 parents 2ba8586 + 96a8829 commit f820386
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/server-extension/query/tokenEntities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,6 @@ FROM
JOIN nft_count as nc ON t.id = nc.token_id
LEFT JOIN cheapest ON t.id = cheapest.token_id
WHERE
nc.supply > 0
nc.supply > 0 AND
($10::text IS NULL OR LOWER(t.name) LIKE LOWER('%' || $10 || '%'))
`
3 changes: 2 additions & 1 deletion src/server-extension/query/totalTokenEntities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ WHERE
($2::bigint IS NULL OR price >= $2::bigint) AND
($3::bigint IS NULL OR price > $3::bigint) AND
($4::bigint IS NULL OR price <= $4::bigint) AND
($7::text[] IS NULL OR nft_entity.collection_id = ANY($7));
($7::text[] IS NULL OR nft_entity.collection_id = ANY($7)) AND
($8::text IS NULL OR LOWER(nft_entity.name) LIKE LOWER('%' || $8 || '%'));
`
4 changes: 3 additions & 1 deletion src/server-extension/resolvers/tokenEntities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ export class TokenResolver {
@Arg('price_gt', { nullable: true }) price_gt?: number,
@Arg('price_lte', { nullable: true }) price_lte?: number,
@Arg('denyList', () => [String], { nullable: true }) denyList?: string[],
@Arg('collections', () => [String], { nullable: true }) collections?: string[]
@Arg('collections', () => [String], { nullable: true }) collections?: string[],
@Arg('name', { nullable: true }) name?: string
): Promise<TokenEntityModel[]> {
const orderQuery = this.getOrderByQuery(orderBy)

Expand All @@ -39,6 +40,7 @@ ORDER BY ${orderQuery} LIMIT $2 OFFSET $3;
denyList,
issuer,
collections,
name
])
return result.map(this.mapRowToTokenEntityByOwner)
}
Expand Down
4 changes: 3 additions & 1 deletion src/server-extension/resolvers/totalTokenEntities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ export class TokenCountResolver {
@Arg('price_gt', { nullable: true }) price_gt?: number,
@Arg('price_lte', { nullable: true }) price_lte?: number,
@Arg('denyList', () => [String], { nullable: true }) denyList?: string[],
@Arg('collections', () => [String], { nullable: true }) collections?: string[]
@Arg('collections', () => [String], { nullable: true }) collections?: string[],
@Arg('name', { nullable: true }) name?: string
): Promise<CountEntity> {
const rawData: CountEntityQueryResult[] = await makeQuery(this.tx, CountEntity, totalTokenEntities, [
owner,
Expand All @@ -27,6 +28,7 @@ export class TokenCountResolver {
denyList,
issuer,
collections,
name,
])
return new CountEntity(rawData[0].total_count)
}
Expand Down

0 comments on commit f820386

Please sign in to comment.