Files
supabase/apps/studio/components/interfaces/Account/AuditLogs.utils.ts
Samir Ketema ee5d4a9314 chore: remove format param from audit log query (#45466)
## I have read the
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
file.

YES

## What kind of change does this PR introduce?

Cleanup after shipping https://github.com/supabase/supabase/pull/45389,
the backend is now defaulting to the new v2 `format`, and made `format`
param optional.

So this:
- removes references to `v2` naming, as this is the only format
- removes the `format` query param from the audit logs API calls

## What is the current behavior?

Same audit log functionality shown in
https://github.com/supabase/supabase/pull/45389

## What is the new behavior?

Functionally the same behavior for audit logs.

- [x] Manual test in staging

## Additional context

⚠️ Will leave the `do-not-merge` tag on until:
- [ ] backend `format` optional PR lands in production.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Refactor**
* Consolidated audit log type definitions and updated internal API
request formatting for audit endpoints across Account and Organization
audit log components. No changes to user-facing functionality or audit
log display.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-05-04 16:24:44 -07:00

13 lines
488 B
TypeScript

import type { AuditLog } from '@/data/organizations/organization-audit-logs-query'
export function sortAuditLogs(logs: AuditLog[], descending: boolean): AuditLog[] {
return [...logs].sort((a, b) =>
descending ? b.timestamp - a.timestamp : a.timestamp - b.timestamp
)
}
export function filterByProjects(logs: AuditLog[], projectRefs: string[]): AuditLog[] {
if (projectRefs.length === 0) return logs
return logs.filter((log) => projectRefs.includes(log.project_ref ?? ''))
}