Created
February 15, 2022 06:26
-
-
Save solancer/7b1a8c7fe374abc1978e63a6623ed4ff to your computer and use it in GitHub Desktop.
Replacing findOne in service - strapi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { createCoreService } = require('@strapi/strapi').factories; | |
| module.exports = createCoreService('api::pack.pack', ({ strapi }) => ({ | |
| // Method 3: Replacing a core service | |
| async findOne(packId, params = {}) { | |
| const entry = await strapi.db.query('api::pack.pack').findOne({ | |
| select: ['label', 'description', 'version'], | |
| where: { packId: packId }, | |
| populate: {definitions: true}, | |
| }); | |
| return entry; | |
| } | |
| }) | |
| ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment