I have "comic" and "comicchapter". the relation between two models is Comic has many Comicchapters.
I want to update the comic on every new comicchapter.
./api/comicchapter/services/Comicchapter.js
async create(data, { files } = {}) {
const entry = await strapi.query("comicchapter").create(data);
if (files) {
// automatically uploads the files based on the entry and the model
await this.uploadFiles(entry, files, { model: strapi.models.comicchapter });
return this.findOne({ id: entry.id });
}
// Updating comic field
await strapi.query("comic").update({ id: entry.comic.id }, { updated: new Date().toISOString() })
return entry;
},
the above code is working if I create a new comicchapter using http post, but it did not work when I create a new comicchapter using contentmanager. using a lifecycle beforeSave afterSave did not return/populate comic in comichapter. so I can not update the comic. any solution to make it work on content manager?
Following my comment about the statement about the thing you are trying to do, you can try to custom the Content Manager backend to match your needs.
You will have to use the customization concept https://strapi.io/documentation/3.0.0-beta.x/concepts/customization.html#plugin-extensions to customize the Content Manager plugin.