From 1a1a7328a3a759b32b11b8fafc806956f1260dab Mon Sep 17 00:00:00 2001 From: KevinMidboe Date: Tue, 4 Jun 2019 23:54:39 +0200 Subject: [PATCH] Map results with total_results before returing. TODO this should be mapped with all wanted list return vars --- seasoned_api/src/request/request.js | 1 + 1 file changed, 1 insertion(+) diff --git a/seasoned_api/src/request/request.js b/seasoned_api/src/request/request.js index 376087a..64d4205 100644 --- a/seasoned_api/src/request/request.js +++ b/seasoned_api/src/request/request.js @@ -111,6 +111,7 @@ class RequestRepository { .then(() => this.sortAndFilterToDbQuery(sort_by, sort_direction, filter_param, query)) .then((dbQuery) => this.database.all(dbQuery)) .then((rows) => Promise.all(this.mapToTmdbByType(rows))) + .then(result => Promise.resolve({results: result, total_results: result.length})) } }