Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

prefixWorkspaceId

Steven Tey441231eee2cf
diff --git a/apps/web/lib/api/audit-logs/get-audit-logs.ts b/apps/web/lib/api/audit-logs/get-audit-logs.ts
index e1f2ee3af8..8196a827df 100644
--- a/apps/web/lib/api/audit-logs/get-audit-logs.ts
+++ b/apps/web/lib/api/audit-logs/get-audit-logs.ts
@@ -1,8 +1,9 @@
import { tb } from "@/lib/tinybird";
import { z } from "zod";
+import { prefixWorkspaceId } from "../workspace-id";
export const auditLogFilterSchemaTB = z.object({
- workspaceId: z.string(),
+ workspaceId: z.string().transform(prefixWorkspaceId),
programId: z.string(),
start: z.string(),
end: z.string(),
diff --git a/apps/web/lib/api/audit-logs/record-audit-log.ts b/apps/web/lib/api/audit-logs/record-audit-log.ts
index 73624d1a26..e601ba35fc 100644
--- a/apps/web/lib/api/audit-logs/record-audit-log.ts
+++ b/apps/web/lib/api/audit-logs/record-audit-log.ts
@@ -5,6 +5,7 @@ import { headers } from "next/headers";
import { z } from "zod";
import { createId } from "../create-id";
import { getIP } from "../utils";
+import { prefixWorkspaceId } from "../workspace-id";
import { auditLogSchemaTB, recordAuditLogInputSchema } from "./schemas";
type AuditLogInput = z.infer<typeof recordAuditLogInputSchema>;
@@ -23,7 +24,7 @@ const transformAuditLogTB = (data: AuditLogInput) => {
return {
id: createId({ prefix: "audit_" }),
timestamp: new Date().toISOString(),
- workspace_id: auditLogInput.workspaceId,
+ workspace_id: prefixWorkspaceId(auditLogInput.workspaceId),
program_id: auditLogInput.programId,
action: auditLogInput.action,
actor_id: auditLogInput.actor.id,