Hi im doing something like this. greetings
async delete(ctx) {
const { id } = ctx.params;
const { id: userId } = ctx.state.user;
const entry = await strapi.db.query("api::wallet.wallet").findOne({
where: { id, user: { id: userId } },
});
if (entry) {
const response = await super.delete(ctx);
return response;
}
return ctx.notFound();
async create(ctx) {
ctx.request.body.data.user = ctx.state.user.id;
const response = await super.create(ctx);
return response;
},