I have a hunch where the error could be. I override the “create” function and that seems to remove a standard validation check for a duplicate entry.
For the moment I rebuild the unique check using a findOne({ email: ctx.request.body.email }) query. If an email address is found, a 422 is sent back:
ctx.send({
message: 'This email address already exists!'
}, 422)
Is there a better way to do this? What would I hve to do, if I wanted to use the original function for that duplication check?