strapi-plugin-comments 2.0.8 → 2.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "strapi-plugin-comments",
3
- "version": "2.0.8",
3
+ "version": "2.0.9",
4
4
  "description": "Strapi - Comments plugin",
5
5
  "strapi": {
6
6
  "name": "comments",
@@ -16,9 +16,6 @@ module.exports = {
16
16
 
17
17
  const { sort: querySort, pagination: queryPagination, ...filterQuery } = query || {};
18
18
 
19
-
20
- console.log(filterQuery);
21
-
22
19
  try {
23
20
  return this.getService('common')
24
21
  .findAllFlat(flatInput(relation, filterQuery, sort || querySort, pagination || queryPagination));
@@ -1,11 +1,12 @@
1
1
  'use strict'
2
2
 
3
+ const { isEmpty } = require('lodash');
3
4
  const contentType = require('../../../content-types/comment');
4
5
  const { flatInput } = require('../../controllers/utils/parsers');
5
6
  const { getPluginService } = require('../../utils/functions');
6
7
 
7
8
  module.exports = ({ strapi, nexus }) => {
8
- const { nonNull, list, stringArg } = nexus;
9
+ const { nonNull, stringArg } = nexus;
9
10
  const { service: getService } = strapi.plugin('graphql');
10
11
  const { args } = getService('internals');
11
12
 
@@ -24,7 +25,10 @@ module.exports = ({ strapi, nexus }) => {
24
25
  relation,
25
26
  getPluginService('gql').graphQLFiltersToStrapiQuery(filters, contentType),
26
27
  sort,
27
- pagination
28
+ pagination ? {
29
+ ...pagination,
30
+ withCount: !isEmpty(pagination),
31
+ } : undefined
28
32
  ), undefined);
29
33
  },
30
34
  };
@@ -74,8 +74,8 @@ module.exports = ({ strapi }) => ({
74
74
  ...prev,
75
75
  [curr]: parseInt(pagination[curr]),
76
76
  }), {});
77
- const { page, pageSize = 10, limit, start = 0 } = parsedPagination
78
- const paginationByPage = !isNil(page);
77
+ const { page = 1, pageSize = 10, start = 0, limit = 10 } = parsedPagination;
78
+ const paginationByPage = !isNil(parsedPagination?.page) || !isNil(parsedPagination?.pageSize);
79
79
 
80
80
  queryExtension = {
81
81
  ...queryExtension,