cap-js / change-tracking

CDS plugin providing out-of-the box support for automatic capturing, storing, and viewing of the change records of modeled entities.
https://cap.cloud.sap/docs
Apache License 2.0
21 stars 8 forks source link

Changelogs erased for deleted entities #87

Closed Hanka0 closed 4 weeks ago

Hanka0 commented 6 months ago

Hello team,

I have noticed that all the changelogs for a parent entity are erased on entity delete: image

However, we have usecase where we are interested in whole entity lifecycle tracking (including the delete action) and keeping these logs. Is there any way to achieve this?

Thank you, Hana

nkaputnik commented 6 months ago

Hello @JocelynGu135 can you confirm this?

luoweihoo commented 6 months ago

Hi Hana,

This approach is used to pursue a simple & autonomous data retention strategy. Can you explain more details of your use case:

  1. Is it sufficient to know the creation / deletion events of the root entity?
  2. or it has to keep all events of the root entity and its subordinate entities?
  3. What's your data retention policy regarding these logs?
  4. Who is going to do the cleaning up?

Best regards, Wei

Hanka0 commented 6 months ago

Hi Wei,

1) My use case being simple booking tool (hence the need to log deletion of the root entity - Reservation ), it is sufficient for me track changes just for the parent.

2) I can imagine tracking entity with all the child entities can be beneficial to other use cases. But again, it is not necessary to my use case.

3) This has not been decided yet, but I assume we should keep the logs for at least a year.

4) There should be a periodical cleanup job scheduled to delete the old entries.

Best regards, Hana

luoweihoo commented 6 months ago

Hi Hana,

Thanks for providing the details! we'll have some internal discussion of your case and decide how to deal with it?

Best regards, Wei

luoweihoo commented 6 months ago

By the way, one more question regarding the following statement: "My use case being simple booking tool (hence the need to log deletion of the root entity - Reservation ), it is sufficient for me track changes just for the parent." Currently the change logs are showed within the root entity, how will you view its change logs if it's already deleted? are you going to develop a dedicated app to view the change logs centrally given they are kept in the table?

Hanka0 commented 6 months ago

Hi Wei,

yes, we would like to expose the logs independently on respective entity. The idea is to expose ChangeView (or perhaps ChangeLog with associated Changes for better readability) as read-only entity in separate tab of the app, visible to admin users only.

Best regards, Hana

Hanka0 commented 5 months ago

Hello team,

is there any new info regarding this issue?

Thank you, Hana

nkaputnik commented 5 months ago

Hello @Hanka0 we have discussed this internally, and while we agree on the premise, there are still a lot of the details needed to be thought out before we can implement it as feature

On the second part of your request - the latest release has an additional annotation, where you can configure whether the UI faces and change-log associatons are created automatically. This way, you can omit the automatic change-log display completely and create an admin-only UI separately.

Best, Nick

nkaputnik commented 2 months ago

Hello @Hanka0 the new release now has the requested functionality. Can you give it a go and provide some feedback?

Thanks and best, Nick

Hanka0 commented 2 months ago

Hi Nick, great, I will give it a try. Thank you, Hana

Hanka0 commented 2 months ago

Hi Nick, at first glance, the changelog now works as desired for our use case. Thank you once again for implementing the change. Best regards, Hana