我有“漫画”和“漫画章节”。这两个模型之间的关系是漫画有许多漫画章节。
我想更新漫画中每一个新的漫画章节。
./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;
},如果我使用http post创建一个新的连环画章节,上面的代码可以工作,但是当我使用contentmanager创建一个新的连环画章节时,它不能工作。使用生命周期beforeSave afterSave不会在Comichater中返回/填充漫画。所以我不能更新漫画。有什么解决方案可以让它在内容管理器上工作吗?
发布于 2020-02-04 00:53:18
根据我关于您正在尝试做的事情的声明的评论,您可以尝试自定义Content Manager后端以满足您的需求。
您必须使用定制概念https://strapi.io/documentation/3.0.0-beta.x/concepts/customization.html#plugin-extensions来定制Content Manager插件。
https://stackoverflow.com/questions/59925324
复制相似问题