.
This commit is contained in:
parent
f926efda9a
commit
e080548da9
@ -84,13 +84,13 @@ function setPaginationInfo(totalCount, res) {
|
||||
limit = (params.paginate && params.paginate.limit) ? params.paginate.limit : null,
|
||||
count = (limit) ? Math.ceil(totalCount / limit) : null;
|
||||
|
||||
if (params.paginate.hasNextPages(count)) {
|
||||
/*if (params.paginate.hasNextPages(count)) {
|
||||
const nextPage = params.paginate.href();
|
||||
res.set('Link-Next-Page', nextPage + '; rel=next');
|
||||
res.set('Pagination-Next-Page', true);
|
||||
} else {
|
||||
res.set('Pagination-Next-Page', false);
|
||||
}
|
||||
}*/
|
||||
|
||||
res.set({
|
||||
'Pagination-Count': count,
|
||||
@ -131,7 +131,6 @@ function handleErrorResponse(controllerName, methodName, error, res) {
|
||||
}
|
||||
|
||||
function handleResultResponse(result, totalCount = null, params, res, statusCode = httpStatus.OK) {
|
||||
console.log('handleResultResponse(result>>>>>>>>>>>>>>', result, getTotalCount(result));
|
||||
setPaginationInfo((totalCount) ? totalCount : getTotalCount(result), res);
|
||||
res.status(statusCode).send(typeof result == 'number' ? result.toString() : result);
|
||||
}
|
||||
|
||||
@ -18,7 +18,7 @@ const extraMethods = {
|
||||
rows = rows.map(comment => commentComposer(comment, context));
|
||||
|
||||
return {
|
||||
count: rows.length,
|
||||
count: result.count,
|
||||
rows: rows
|
||||
}
|
||||
},
|
||||
|
||||
@ -19,7 +19,7 @@ const extraMethods = {
|
||||
rows = rows.map(entity => entityComposer(entity, context));
|
||||
|
||||
return {
|
||||
count: rows.length,
|
||||
count: result.count,
|
||||
rows: rows
|
||||
}
|
||||
},
|
||||
|
||||
@ -24,7 +24,7 @@ const extraMethods = {
|
||||
rows = rows.map(event => eventComposer(event, context));
|
||||
|
||||
return {
|
||||
count: rows.length,
|
||||
count: result.count,
|
||||
rows: rows
|
||||
}
|
||||
|
||||
|
||||
@ -63,7 +63,7 @@
|
||||
"response-time": "^2.3.2",
|
||||
"safename": "^1.0.2",
|
||||
"sanitize-filename": "^1.6.2",
|
||||
"sequelize": "^5.6.1",
|
||||
"sequelize": "^5.16.0",
|
||||
"sharp": "^0.23.0",
|
||||
"unique-file-name": "^1.0.0",
|
||||
"vimeo": "^2.1.1",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user