Coder Social home page Coder Social logo

Comments (6)

anuko avatar anuko commented on August 14, 2024

Perhaps, best is to support this in the product for compliance with all sorts of rules and regulations, as the issue occasionally comes up.

from timetracker.

avidenic avatar avidenic commented on August 14, 2024

I was thinking that as well. The next question is: for the sake of code maintainability, does it make sense to introduce an ORM, so we can do audit trail in one place?

from timetracker.

anuko avatar anuko commented on August 14, 2024

What exactly are you suggesting? An additional audit log table where everything goes, when enabled?

from timetracker.

avidenic avatar avidenic commented on August 14, 2024

Yes. I propose it to be as simple as possible, with these fields:

  • id - primary key
  • user_id (foreign key to user)
  • state (added / deleted / modified)
  • type / name of db object
  • old value - serialised object into JSON. empty in case record was added
  • new value - serialised object into JSON, empty in case record was deleted
  • table name - in case of nested objects, we keep just changes for parent. its up for discussion
  • identity - primary key(s) of the object serialised into JSON so we can link it to the record in DB
  • timestamp

we can than calculate differences for each change on the fly if needed (by iterating through objects properties) - for displaying to the user.

What do you think? I would prefer to have some kind of ORM, so this can be implemented to work "automagically", but it would be big enough task as it is, and maybe we move this to "phase 2".

from timetracker.

anuko avatar anuko commented on August 14, 2024

How about simply having created, created_by, created_ip, modified, modified_by, modified_ip fields for all entities in sql tables that matter (similarly to what we have in tt_groups, tt_users, and tt_log now). This looks pretty straightforward and does not over-complicate things.

created datetime default NULL, # creation timestamp
created_ip varchar(45) default NULL, # creator ip
created_by int(11) default NULL, # creator user_id
modified datetime default NULL, # modification timestamp
modified_ip varchar(45) default NULL, # modifier ip
modified_by int(11) default NULL, # modifier user_id

from timetracker.

avidenic avatar avidenic commented on August 14, 2024

Hi,

sorry for the late reply. Sadly this is not enough. We've checked out some options and I implemented a rudimentary support a while ago but did not create a merge request because feature is not finished.

You can check the changes here: https://github.com/avidenic/timetracker/tree/audit_log

When I find the time I will finish it - add UI, settings etc....

from timetracker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.