.
This commit is contained in:
parent
4716a4252a
commit
403d7690b4
@ -86,7 +86,7 @@ function setPaginationInfo(totalCount, res) {
|
||||
|
||||
if (params.paginate.hasNextPages(count)) {
|
||||
const nextPage = params.paginate.href();
|
||||
res.set('Link', nextPage + '; rel=next');
|
||||
res.set('Link-Next-Page', nextPage + '; rel=next');
|
||||
res.set('Pagination-Next-Page', true);
|
||||
} else {
|
||||
res.set('Pagination-Next-Page', false);
|
||||
|
||||
@ -151,6 +151,11 @@ const generateService = (model, extraMethods = {}, options = defaultOptions) =>
|
||||
return defaultService.fetchAssociation(params, context)
|
||||
} else {
|
||||
const findOptions = parseParamsToFindOptions(params);
|
||||
|
||||
// Necesario para el cálculo del count
|
||||
// https://github.com/sequelize/sequelize/issues/10557
|
||||
findOptions.distinct = true;
|
||||
|
||||
const result = await model.scope(context.scopes).findAndCountAll(findOptions);
|
||||
|
||||
if (extraMethods.afterFetchAll) {
|
||||
|
||||
@ -23,7 +23,7 @@ routes.get('/speakers',
|
||||
PaginateMiddleware.middleware(),
|
||||
SortMiddleware.middleware({ default: "name" }),
|
||||
speakerController.find({
|
||||
scopes: ['defaultScope', 'includeValues'],
|
||||
scopes: ['defaultScope', 'includeValues', 'includeMultimedias'],
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@ const extraMethods = {
|
||||
rows = rows.map(speaker => speakerComposer(speaker, context));
|
||||
|
||||
return {
|
||||
count: rows.length,
|
||||
count: result.count,
|
||||
rows: rows
|
||||
}
|
||||
},
|
||||
|
||||
Loading…
Reference in New Issue
Block a user