Skip to content

Commit

Permalink
fix: Unsupported projection option for hasMarkup field (second try)
Browse files Browse the repository at this point in the history
  • Loading branch information
FlorianGille committed May 16, 2024
1 parent 444789d commit 7bfe445
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/server/template/template.schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,16 +110,18 @@ TemplateSchema.statics.findForApi = async function findForApi(query = {}) {
updatedAt: 1,
_company: 1,
assets: 1,
hasMarkup: { $ne: ['$markup', null] },
markup: 1,
})
.populate({ path: '_company', select: 'id name' })
.sort({ name: 1 })
.lean();

const finalTemplates = templates.map(({ assets, ...template }) => ({
const finalTemplates = templates.map(({ assets, markup, ...template }) => ({
...template,
hasMarkup: markup !== null,
coverImage: JSON.parse(assets)?.['_full.png'] || null,
}));

return finalTemplates;
};

Expand Down

0 comments on commit 7bfe445

Please sign in to comment.