Strapi : is it possible to track users modifying content?

偶尔善良 提交于 2019-12-08 04:52:21

问题


I'm currently doing some research on Strapi in order to build my API on it, and I was wondering if it's possible to expose in the JSON a field that would contain information about the user responsible for the last modification on a particular content ?

I know the API exposes an "updatedAt" field in the JSON object by default that contains the datetime it was last updated, but as I understand it this field is handled by the database when the data is sent to it for persistance ?

Any help would be greatly appreciated ! Thanks a lot.


回答1:


There is not this feature by default in Strapi.

You have access to the code of your app, so you can add it yourself.

You can create an History content type with relation with users and you models. Then by updating the lifecycle of your entry (afterCreate and beforeUpdate) you create an new history by link your entry id and you user id.



来源:https://stackoverflow.com/questions/51541555/strapi-is-it-possible-to-track-users-modifying-content

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!