Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add database auditability #196

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
Draft

Add database auditability #196

wants to merge 10 commits into from

Conversation

jmaupetit
Copy link
Member

@jmaupetit jmaupetit commented Oct 15, 2024

Purpose

We need to be able to track who changed what when on most of our data for auditability purpose.

Proposal

  • add created_by_id and updated_by_id fields in auditable models
  • add track_model_changes utility that can be triggered upon SQLAlchemy events
  • integrate model changes tracking in API routes
  • assess performance impact

@jmaupetit jmaupetit added feature WIP API Item related to the API service labels Oct 15, 2024
@jmaupetit jmaupetit self-assigned this Oct 15, 2024
@jmaupetit jmaupetit linked an issue Oct 15, 2024 that may be closed by this pull request
3 tasks
)
).one()
assert pdc7.paiement_cb
assert len(pdc7.audits) == 1
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it fails because when listening the "after_update" event in an upsert context, the event is never raised on "conflict do update"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should create a custom event?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Item related to the API service feature WIP
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Actions auditability
1 participant