diff --git a/packages/evershop/src/modules/cms/pages/frontStore/cmsPageView/index.js b/packages/evershop/src/modules/cms/pages/frontStore/cmsPageView/index.js index 0f53246d0..1e513ec1d 100644 --- a/packages/evershop/src/modules/cms/pages/frontStore/cmsPageView/index.js +++ b/packages/evershop/src/modules/cms/pages/frontStore/cmsPageView/index.js @@ -1,24 +1,18 @@ -const { select } = require('@evershop/postgres-query-builder'); const { pool } = require('@evershop/evershop/src/lib/postgres/connection'); const { setContextValue } = require('../../../../graphql/services/contextHelper'); +const { + getCmsPagesBaseQuery +} = require('../../../services/getCmsPagesBaseQuery'); module.exports = async (request, response, delegate, next) => { try { - const query = select(); + const query = getCmsPagesBaseQuery(); query - .from('cms_page') - .leftJoin('cms_page_description') - .on( - 'cms_page.cms_page_id', - '=', - 'cms_page_description.cms_page_description_cms_page_id' - ); - - query.where('cms_page_description.url_key', '=', request.params.url_key); + .where('cms_page_description.url_key', '=', request.params.url_key) + .and('cms_page.status', '=', 1); const page = await query.load(pool); - if (page === null) { response.status(404); next();