I made the following modifications to allow GET (findOne) requests by slug. However, I am not able to execute POST and DELETE requests by the slug. Can anyone help?
/**
* end-user controller
*/
const { createCoreController } = require("@strapi/strapi").factories;
module.exports = createCoreController(
"api::end-user.end-user",
({ strapi }) => ({
async findOne(ctx) {
const { id } = ctx.params;
const entity = await strapi.db.query("api::end-user.end-user").findOne({
where: { userId: id },
});
const sanitizedEntity = await this.sanitizeOutput(entity, ctx);
return this.transformResponse(sanitizedEntity);
},
})
);```
<i>This topic has been created from a Discord post (1273594979662434356) to give it more visibility.
It will be on Read-Only mode here.
<a href="https://discord.com/channels/811989166782021633/1273594979662434356/1273594979662434356">Join the conversation on Discord</a></i>