Skip to content

feat: implement audit logging for inventory and order services#22

Merged
codewithme-py merged 1 commit intomainfrom
feat/audit-logging-prices-and-statuses
Mar 16, 2026
Merged

feat: implement audit logging for inventory and order services#22
codewithme-py merged 1 commit intomainfrom
feat/audit-logging-prices-and-statuses

Conversation

@codewithme-py
Copy link
Copy Markdown
Owner

  • Audit infrastructure: A polymorphic AuditLog model has been created to record changes of any entities. Added middleware for automatic capture of request_id and remote_ip, which provides end-to-end tracing of user actions.

  • Diff service: Implemented AuditLogService with the logic of automatic comparison of the states of Pydantic models. Now every significant change records the old and new state of the fields in JSON format.

  • Integration in Inventory: Logging is implemented in all methods of product service (creation, update, change of status, deletion). Atomicity is ensured: the audit record takes place in the same transaction as the business logic.

  • Integration in Orders: Order life cycle audit is configured. Problems with lazy-loading when forming state snapshots in an asynchronous context (forced refresh of related items) have been solved.

@codewithme-py codewithme-py merged commit 9634e9f into main Mar 16, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant