Skip to content

[BE-05] Create AuditLog entity with TypeORM in opsce module #733

@yusuftomilola

Description

@yusuftomilola

Problem

There is no audit trail for any actions performed in the system. When an asset is created, updated, or transferred, there is no record of who made the change or when.

Proposed Solution

Create backend/src/opsce/audit/entities/audit-log.entity.ts. This should be a write-once, append-only entity. Create an AuditService with a log() method injected by other services.

Acceptance Criteria

  • Entity has fields: id (UUID), userId, action (string), resourceType (string), resourceId (string), oldValue (JSON), newValue (JSON), ipAddress, userAgent, createdAt
  • No updatedAt or deletedAt (audit logs are immutable)
  • @Index() on userId, resourceType, resourceId, createdAt
  • AuditService.log(dto) method created for use by other modules
  • Module registered in OpsceModule

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions