simnova / ownercommunity

MIT License
5 stars 1 forks source link

Fix violation ticket audit #302

Closed mgupta83 closed 1 week ago

mgupta83 commented 1 week ago

Related to #301

Add Audit decorator to set activityBy in the activity log of the violation-ticket domain model.


For more details, open the Copilot Workspace session.

Summary by Sourcery

Fix the violation ticket audit by adding an Audit decorator and updating methods to use AuditContextFactory for setting activityBy in the activity log.

Bug Fixes:

Enhancements:

sourcery-ai[bot] commented 1 week ago

Reviewer's Guide by Sourcery

This pull request implements an audit functionality for the violation ticket domain model, specifically for the ActivityDetail class. It adds an @Audit decorator to the setActivityBy method and updates the implementation to use an AuditContextFactory for setting the activityBy property. The changes aim to improve the tracking of who performed specific activities in the violation ticket system.

File-Level Changes

Change Details Files
Implement audit functionality for ActivityDetail
  • Add @Audit decorator to setActivityBy method
  • Update setActivityBy method to accept AuditContextFactoryType
  • Implement setActivityBy method using AuditContextFactory
  • Import Audit decorator and AuditContextFactoryType
data-access/src/app/domain/contexts/cases/violation-ticket/v1/activity-detail.ts
Update ActivityDetailDomainAdapter to use AuditContextFactory
  • Import AuditContextFactory
  • Modify setActivityByRef method to use AuditContextFactory
  • Update method signature to accept a function to get member reference
data-access/src/infrastructure-services-impl/datastore/mongodb/infrastructure/cases/violation-ticket/v1/violation-ticket.domain-adapter.ts

Sequence Diagram

sequenceDiagram
    participant Client
    participant ActivityDetail
    participant AuditContextFactory
    participant ActivityDetailProps

    Client->>ActivityDetail: setActivityBy(AuditContextFactory)
    activate ActivityDetail
    ActivityDetail->>AuditContextFactory: getMemberRef()
    activate AuditContextFactory
    AuditContextFactory-->>ActivityDetail: memberRef
    deactivate AuditContextFactory
    ActivityDetail->>ActivityDetailProps: setActivityByRef(memberRef)
    deactivate ActivityDetail

Tips and commands - Trigger a new Sourcery review by commenting `@sourcery-ai review` on the pull request. - Continue your discussion with Sourcery by replying directly to review comments. - You can change your review settings at any time by accessing your [dashboard](https://app.sourcery.ai): - Enable or disable the Sourcery-generated pull request summary or reviewer's guide; - Change the review language; - You can always [contact us](mailto:support@sourcery.ai) if you have any questions or feedback.