Hello,
I want to change my findOne-controller to get the data via slug and not via id.
This works well for my article-model.
But with the same code I got problems for my article categories. I always get an 500 internal server error
My code from /app/api/article-category/controllers/article-category.js:
const { sanitizeEntity } = require('strapi-utils');
module.exports = {
async findOne (ctx) {
const { slug } = ctx.params;
const entity = await strapi.services.article-category.findOne({ slug });
return sanitizeEntity(entity, { model: strapi.models.article-category });
},
};
I don’t know what the right naming to get the services and model for my article-category.
Thanks for some help with this!
Best regards,
Timo