Skip to content

Commit

Permalink
fix(dashboard): filter Audit Logs by active keys and rate limits
Browse files Browse the repository at this point in the history
  • Loading branch information
unrenamed committed Oct 14, 2024
1 parent 30a85b4 commit 5284511
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion apps/dashboard/app/(app)/audit/[bucket]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export default async function AuditPage(props: Props) {
and(eq(table.tenantId, tenantId), isNull(table.deletedAt)),
with: {
ratelimitNamespaces: {
where: (table, { isNull }) => isNull(table.deletedAt),
columns: {
id: true,
name: true,
Expand Down Expand Up @@ -358,7 +359,12 @@ const UserFilter: React.FC<{ tenantId: string }> = async ({ tenantId }) => {

const RootKeyFilter: React.FC<{ workspaceId: string }> = async ({ workspaceId }) => {
const rootKeys = await db.query.keys.findMany({
where: (table, { eq }) => eq(table.forWorkspaceId, workspaceId),
where: (table, { eq, and, or, isNull, gt }) =>
and(
eq(table.forWorkspaceId, workspaceId),
isNull(table.deletedAt),
or(isNull(table.expires), gt(table.expires, new Date())),
),
columns: {
id: true,
name: true,
Expand Down

0 comments on commit 5284511

Please sign in to comment.