Description
Group state changes, membership updates, and settlement executions produce audit logs. Administrators and members need a dedicated API endpoint to retrieve group audit records with cursor-based pagination and filtering by action type or date range.
Context & Requirements
- Endpoint path:
GET /groups/:groupId/audit-logs.
- Access control: Require active membership in the specified group.
- Query parameters must be validated using Zod:
limit (1-100, default 20), cursor (string/ID), action (optional string filter), startDate and endDate (ISO dates).
- Response must return audit items along with a
nextCursor for pagination.
Acceptance Criteria
Implementation Guidance
- Reference existing group route handlers in
src/routes/ for authentication and membership validation patterns.
- Ensure Prisma queries filter by
groupId, optional action, and date range constraints.
- Format responses consistently with established API output contracts.
Testing & Validation
- Execute unit and integration tests via
npm test.
- Verify response schema matches mirrored web types in
mergepay-web/src/lib/types.ts.
Submission Guidelines
- Open a PR that includes "Closes #".
- Request task assignment on the issue before beginning work.
- Follow standard code conventions and pass
npm run lint.
Wave complexity: Medium
Description
Group state changes, membership updates, and settlement executions produce audit logs. Administrators and members need a dedicated API endpoint to retrieve group audit records with cursor-based pagination and filtering by action type or date range.
Context & Requirements
GET /groups/:groupId/audit-logs.limit(1-100, default 20),cursor(string/ID),action(optional string filter),startDateandendDate(ISO dates).nextCursorfor pagination.Acceptance Criteria
getGroupAuditLogsmethod insrc/services/auditLogService.tssupporting cursor pagination and filters.GET /groups/:groupId/audit-logsendpoint insrc/routes/auditLogs.ts.Implementation Guidance
src/routes/for authentication and membership validation patterns.groupId, optionalaction, and date range constraints.Testing & Validation
npm test.mergepay-web/src/lib/types.ts.Submission Guidelines
npm run lint.Wave complexity: Medium