Skip to content

Commit

Permalink
Merge pull request #116 from kodadot/main
Browse files Browse the repository at this point in the history
🔖 Stick v5.0.1
  • Loading branch information
vikiival authored Oct 13, 2023
2 parents cccdc2c + 8ca0758 commit 92f040e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/server-extension/query/tokenEntities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ filters_applied AS (
FROM nft_entity ne
WHERE
($1::text IS NULL OR ne.current_owner = $1) AND
($8::text IS NULL OR ne.issuer = $8) AND
($7::text[] IS NULL OR ne.issuer NOT IN (SELECT unnest($7))) AND
($4::bigint IS NULL OR ne.price >= $4::bigint) AND
($5::bigint IS NULL OR ne.price > $5::bigint) AND
Expand Down
3 changes: 2 additions & 1 deletion src/server-extension/query/totalTokenEntities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ export const totalTokenEntities = `
SELECT COUNT(id) as total_count
FROM nft_entity
WHERE
($1::text IS NULL OR current_owner = $1) AND
($1::text IS NULL OR current_owner = $1) AND
($6::text IS NULL OR issuer = $6) AND
($5::text[] IS NULL OR issuer NOT IN (SELECT unnest($5))) AND
($2::bigint IS NULL OR price >= $2::bigint) AND
($3::bigint IS NULL OR price > $3::bigint) AND
Expand Down
2 changes: 2 additions & 0 deletions src/server-extension/resolvers/tokenEntities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export class TokenResolver {
@Arg('limit', () => Int, { nullable: true, defaultValue: 40 }) limit: number,

@Arg('owner', { nullable: true }) owner?: string,
@Arg('issuer', { nullable: true }) issuer?: string,
@Arg('offset', () => Int, { nullable: true, defaultValue: 0 }) offset?: number,
@Arg('orderBy', () => [String], { nullable: true, defaultValue: [OrderBy.blockNumber_DESC] }) orderBy?: string[],
@Arg('price_gte', { nullable: true }) price_gte?: number,
Expand All @@ -35,6 +36,7 @@ ORDER BY ${orderQuery} LIMIT $2 OFFSET $3;
price_gt,
price_lte,
denyList,
issuer,
])
return result.map(this.mapRowToTokenEntityByOwner)
}
Expand Down
2 changes: 2 additions & 0 deletions src/server-extension/resolvers/totalTokenEntities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export class TokenCountResolver {
@Query(() => CountEntity)
async tokenEntityCount(
@Arg('owner', { nullable: true }) owner?: string,
@Arg('issuer', { nullable: true }) issuer?: string,
@Arg('price_gte', { nullable: true }) price_gte?: number,
@Arg('price_gt', { nullable: true }) price_gt?: number,
@Arg('price_lte', { nullable: true }) price_lte?: number,
Expand All @@ -23,6 +24,7 @@ export class TokenCountResolver {
price_gt,
price_lte,
denyList,
issuer,
])
return new CountEntity(rawData[0].total_count)
}
Expand Down

0 comments on commit 92f040e

Please sign in to comment.