Skip to content

Commit

Permalink
fix: use PbPagesListPage for simple listing of pages
Browse files Browse the repository at this point in the history
  • Loading branch information
adrians5j committed Aug 12, 2020
1 parent 58dd5cc commit 74a43a7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ListResponse, requiresTotalCount } from "@webiny/graphql";

export const listPages = async ({ context, args, info }) => {
const { PbPage } = context.models;
const { PbPagesListPage } = context.models;
const { limit = 10, after, before, sort = null, parent = null } = args;

const query: any = {
Expand All @@ -21,7 +21,7 @@ export const listPages = async ({ context, args, info }) => {
};
}

return await PbPage.find({
return await PbPagesListPage.find({
sort,
limit,
after,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ import { ListResponse, requiresTotalCount } from "@webiny/graphql";
import { GraphQLResolveInfo } from "graphql";

export const listPublishedPages = async params => {
const { context, args, info = null } = params;
const { PbCategory, PbPage } = context.models;
const { pageModel, context, args, info = null } = params;
const { PbCategory, PbPagesListPage } = context.models;

const PbPageModel = pageModel || PbPagesListPage;

const {
search,
Expand Down Expand Up @@ -73,7 +75,7 @@ export const listPublishedPages = async params => {
}
}

return PbPage.find({
return PbPageModel.find({
query: { $and: baseFilters },
sort,
limit,
Expand Down

0 comments on commit 74a43a7

Please sign in to comment.