Preformatted text``Preformatted text
[details=“System Information”]
- Strapi Version: V4
- Operating System: Linux
- Database: MySQL
- Node Version: 16.14.2
- NPM Version: 8.7.0
-
Yarn Version:
[/details]
I modified the controller, but I don’t know how can I select some product in DB by “created_by_id”. I’m trying something like this:
module.exports = createCoreController(‘api::produto.produto’, ({ strapi }) => ({
async findOne(ctx) {
const { user } = ctx.state;
const { id } = ctx.params;
const { query } = ctx;
const entity = await strapi.service('api::produto.produto').findOne({
id, query,
where: {
'created_by_id': user.id
}
});
}));
but this format is not possible… someone got it?
Thanks