feat(audit): implement platform-wide audit logging#302
feat(audit): implement platform-wide audit logging#302betterclever wants to merge 2 commits intomainfrom
Conversation
Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
Signed-off-by: betterclever <paliwal.pranjal83@gmail.com>
9f87238 to
0963c3a
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9f87238fd2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| setCursor(nextCursor); | ||
| load('next').catch(() => {}); |
There was a problem hiding this comment.
Use updated cursor when loading next audit log page
This handler sets cursor and immediately calls load('next'), but load reads query from the current render before the state update is applied. When users click “Load more” from the first page, the request is sent with the old cursor (undefined), so page 1 is fetched again and appended as duplicates; similar stale-state behavior also affects other flows that call setCursor(...) and then load(...) synchronously. Pass the next cursor directly into load (or trigger loading from cursor changes) so pagination requests always use the intended cursor.
Useful? React with 👍 / 👎.
| import { AuditLogService } from './audit-log.service'; | ||
| import { | ||
| ListAuditLogsQuerySchema, | ||
| type ListAuditLogsQueryDto, |
There was a problem hiding this comment.
Import audit query DTO as value for OpenAPI reflection
Using a type-only import for ListAuditLogsQueryDto strips the runtime class reference that Swagger relies on for @Query metadata, so this commit’s generated schema omits all /audit-logs query params (and the generated backend client shows query?: never for AuditLogsController_list). That makes typed SDK consumers unable to pass filters/cursor/limit even though the endpoint supports them; import the DTO as a value (or add explicit @ApiQuery declarations) to keep the contract accurate.
Useful? React with 👍 / 👎.
Summary
audit_logsdatabase table and Drizzle migrationAuditLogServiceandAuditLogRepositorywith full CRUD + filteringGET /audit-logsREST endpoint with org-scoped accessAuditLogSettingspage under SettingsTest plan
pnpm test— unit tests forAuditLogService,AuthGuard,SecretsService,WebhooksServicepasse2e-tests/core/audit-logs.test.tscovers create/list/filter flows0020_create-audit-logs.sqlapplies cleanly against dev DBCloses ENG-174
🤖 Generated with Claude Code