Skip to content

[BHO-47]: add audit log routes - #73

Open
devluharuwalla wants to merge 2 commits into
mainfrom
47-audit-log-routes
Open

devluharuwalla wants to merge 2 commits into
mainfrom
47-audit-log-routes

Conversation

@devluharuwalla

Copy link
Copy Markdown

ℹ️ Issue

Closes #47

📝 Description

Adds audit log routes to the internal serving lambda.

  1. GET /audit-log: newest first, with filters for changedFrom, changedTo, tableName, importId and rowKey
  2. GET /audit-log/{id}: returns one entry
  3. Documented both in openapi.yml

✔️ Verification

  • Unit tests for both routes. All 167 tests pass.

🏕️ (Optional) Future Work / Notes

  • The ticket asks for cursor pagination. I used the same limit/offset paging as /imports so both routes match.

github-actions Bot added a commit that referenced this pull request Nov 17, 2026
# Conflicts:
#	apps/backend/internal-serving-lambda/openapi.yml
#	apps/backend/internal-serving-lambda/src/routes.ts

@naman0r naman0r left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The routes and query look right: rowKey is passed as a bound parameter, and ties on changedAt are broken by id. The branch had conflicts with main, so I pushed 781b729:

  • Merged main, keeping both sides' routes in routes.ts and both sides' paths and schemas in openapi.yml.
  • The two audit-log tests mocked getCurrentUser as { id: 'user-123' }. Since #100, CurrentUser is { id: number, email, role }.

Non-blocking: the ticket asks for cursor paging that returns { items, nextCursor }. This uses limit/offset like /imports, while /entries (#79) uses a cursor, so the list routes now page two different ways. We should pick one in a follow-up.

@naman0r
naman0r requested a review from cheangie November 22, 2026 22:17

@Rayna-Yu Rayna-Yu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small change


// The tables with an audit trigger (see db/migrations), so the only values
// tableName can have
export const AUDITED_TABLES = [

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small change can you add daily discussions to the audited tables

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dev: Internal serving lambda audit routes

4 participants