Skip to content

Commit

Permalink
[DOCS-3328] Turn on typechecking for GET /products/by-price (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrodewig authored Sep 9, 2024
1 parent c0168f0 commit f3ca951
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/routes/products/products.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,10 +316,12 @@ router.get(
// which require document reads.
// Learn more about covered queries here: https://docs.fauna.com/fauna/current/learn/data_model/indexes#covered-queries
const query = fql`
Product.sortedByPriceLowToHigh({ from: ${Number(
let products: Any = Product.sortedByPriceLowToHigh({ from: ${Number(
minPrice
)}, to: ${Number(maxPrice)}})
.pageSize(${Number(pageSize)}) {
.pageSize(${Number(pageSize)})
products {
id,
name,
price,
Expand All @@ -336,7 +338,7 @@ router.get(
const { data: products } = await faunaClient.query<Page<Product>>(
// If a nextToken is provided, use the Set.paginate function to get the next page of products.
// Otherwise, use the query defined above which will fetch the first page of products.
decodedNextToken ? fql`Set.paginate(${decodedNextToken})` : query, { typecheck: false }
decodedNextToken ? fql`Set.paginate(${decodedNextToken})` : query
);

// Encode the nextToken before sending it back to the client.
Expand Down

0 comments on commit f3ca951

Please sign in to comment.