I've created a bunch of collections in strapi using cammelCase:
However, this created the following file structure:
/api/class-resource/controllers/class-resource.js
Now, when I try to follow this guide to create a custom controller, the js compiler won't let me call the service I need because it thinks I'm subtracting:
module.exports = {
/**
* Create a record.
*
* @return {Object}
*/
async create(ctx) {
let entity;
if (ctx.is('multipart')) {
const { data, files } = parseMultipartData(ctx);
data.author = ctx.state.user.id;
entity = await strapi.services.class-resource.create(data, { files }); //problem here
} else {
ctx.request.body.author = ctx.state.user.id;
entity = await strapi.services.class-resource.create(ctx.request.body); //problem here
}
return sanitizeEntity(entity, { model: strapi.models.class-resource}); //problem here
},
};
is there any way around this, other than renaming all my content types?
This solution was given to me by Pascal Isman in the strapi community slack:
strapi.services['camel-case'].create(...)