From a08896bb4c39ac581b5056c2f932c29ee766c38a Mon Sep 17 00:00:00 2001 From: Park Juhyung Date: Wed, 22 Apr 2020 12:21:13 +0900 Subject: [PATCH 1/2] Fix hasNextPage bug in snapshot --- src/models/logic/utxo.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/models/logic/utxo.ts b/src/models/logic/utxo.ts index fbe2462..7f0c031 100644 --- a/src/models/logic/utxo.ts +++ b/src/models/logic/utxo.ts @@ -506,8 +506,7 @@ export async function getSnapshot(params: { transaction, type: sequelize.QueryTypes.SELECT } - )).count === - itemsPerPage + 1; + )).count === String(itemsPerPage + 1); // The SQL query is copied from the query above. const lastRow = await models.sequelize.query( From 065675c210a0ba50536d02c686480dfc8b8d824c Mon Sep 17 00:00:00 2001 From: Park Juhyung Date: Wed, 22 Apr 2020 12:34:35 +0900 Subject: [PATCH 2/2] Parse lastEvaluatedKey in snapshot query --- src/routers/asset.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/routers/asset.ts b/src/routers/asset.ts index 3e071cd..4b2f5d8 100644 --- a/src/routers/asset.ts +++ b/src/routers/asset.ts @@ -540,7 +540,10 @@ export function handle(context: IndexerContext, router: Router) { async (req, res, next) => { const assetTypeString = req.query.assetType; const date = req.query.date; - const lastEvaluatedKey = req.query.lastEvaluatedKey; + let lastEvaluatedKey = req.query.lastEvaluatedKey; + if (typeof lastEvaluatedKey === "string") { + lastEvaluatedKey = JSON.parse(lastEvaluatedKey); + } try { const assetType = new H160(assetTypeString); const snapshotTime = moment(date);