mirror of
https://github.com/supabase/supabase.git
synced 2026-06-13 19:01:50 +08:00
## 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 -->
13 lines
488 B
TypeScript
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 ?? ''))
|
|
}
|