Skip to content

Commit

Permalink
Merge pull request #286 from kodadot/main
Browse files Browse the repository at this point in the history
🔝🔖 Speck v12
  • Loading branch information
vikiival authored Jun 24, 2024
2 parents ec51cb2 + d130b1e commit 572177e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/server-extension/model/tokenEntity.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ export enum OrderBy {
createdAt_DESC = "createdAt_DESC",
price_ASC = "price_ASC",
price_DESC = "price_DESC",

price_ASC_NULLS_FIRST = "price_ASC_NULLS_FIRST",
price_ASC_NULLS_LAST = "price_ASC_NULLS_LAST",
price_DESC_NULLS_FIRST = "price_DESC_NULLS_FIRST",
price_DESC_NULLS_LAST = "price_DESC_NULLS_LAST",
}

registerEnumType(OrderBy, {
Expand Down Expand Up @@ -167,4 +170,3 @@ export class TokenEntityQueryResult {
Object.assign(this, props);
}
}

6 changes: 5 additions & 1 deletion src/server-extension/resolvers/tokenEntities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,11 @@ ORDER BY ${orderQuery} LIMIT $2 OFFSET $3;
[OrderBy.updatedAt_DESC]: 'updated_at DESC',
[OrderBy.price_ASC]: 'cheapest_price ASC',
[OrderBy.price_DESC]: 'cheapest_price DESC',
}
[OrderBy.price_ASC_NULLS_FIRST]: 'cheapest_price ASC NULLS FIRST',
[OrderBy.price_ASC_NULLS_LAST]: 'cheapest_price ASC NULLS LAST',
[OrderBy.price_DESC_NULLS_FIRST]: 'cheapest_price DESC NULLS FIRST',
[OrderBy.price_DESC_NULLS_LAST]: 'cheapest_price DESC NULLS LAST',
};

private getOrderByQuery(orderBy: string[] = [OrderBy.blockNumber_DESC]): string {
return orderBy.map((order) => this.ORDER_BY_MAPPING[order]).join(', ')
Expand Down

0 comments on commit 572177e

Please sign in to comment.