feat(alerts): fix #122 by implementing alert acknowledgement system
feat(alerts): fix #122 alert acknowledgement system
This pull request implements the Alert Acknowledgement System to resolve issue #122. Previously, there was no way for the security team to distinguish between unreviewed alerts and those that had been investigated. This caused potential overlap in work and confusion.
With this change, the Alert model now tracks acknowledgedAt and acknowledgedBy. An AcknowledgementsModule provides a new REST endpoint (POST /alerts/:id/acknowledge) allowing reviewers to explicitly mark alerts as acknowledged. To maintain data integrity and compliance, acknowledging an alert automatically appends an ALERT_ACKNOWLEDGED action to the system's AuditLog within a single atomic database transaction.
- Modified
schema.prismato includeacknowledgedAtandacknowledgedByon theAlertmodel. - Added
@nestjs/commonand@nestjs/coreto package dependencies to resolve project-wide TS compilation issues. - Created
AlertsModuleandAcknowledgementsModulefollowing the NestJS module architecture. - Created
AcknowledgementsControllerwith aPOST /alerts/:id/acknowledgeendpoint. - Implemented
AcknowledgementsServiceto handle the atomic acknowledgement and audit logging via Prisma$transaction. - Defined
AcknowledgeAlertDtoto capturereviewerIdandreviewerName. - Registered
AlertsModuleintoapp.module.ts.
- Executed
npm run build:backendto ensure strict TypeScript compilation passes without errors. - Re-generated the Prisma client using
pnpm dlx prisma generateand verified that schema changes were accurately reflected. - Verified the atomicity constraint in code (Prisma
$transactionwrapper used for DB operations).
- Backend-only change: Modifies only the Sentinel NestJS backend and PostgreSQL database schema.
- No Contract Logic Changes: Does not impact any on-chain or soroban logic.
- Excluded Files:
PR_NOTES.mdandimplementation.mdhave been explicitly excluded from this commit to keep documentation artifacts out of the deployment package.
None. The new acknowledgedAt and acknowledgedBy fields are fully backwards-compatible (nullable).
Closes #122
git push -u origin implement-alert