I am trying to override the core controller to auto update a field when a new entry is created in my announcements page. But when when Itry to override the methods for create update or delete it doesnt work while the same works for the find method. Can anyone help identify what the issue is?
'use strict';
/**
* announcement controller
*/
const { createCoreController } = require('@strapi/strapi').factories;
module.exports = createCoreController('api::announcement.announcement', ({strapi}) => ({
async find(ctx){
const { data, meta } = await super.find(ctx);
console.log("-----------------------------------------");
console.log(data);
return { data, meta }
},
async create(ctx) {
console.log('-------------------CREATE------------------------------');
const response = await super.create(ctx);
console.log("-----------RESPONSE-------------");
console.log(response);
return response;
},
async update(ctx) {
console.log("---------------------UPDATE----------------------------");
const response = await super.update(ctx);
console.log("----------------------");
console.log(response);
return response;
},
async delete(ctx) {
// some logic here
console.log("---------------------DELETEE----------------------------");
const response = await super.delete(ctx);
// some more logic
return response;
},
}));
type or paste code here