问题
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