Skip to content

A full-featured CRM built with React, shadcn/ui, and Supabase.

Centralize attachments bucket constant

Anibal Svarcas075278dbdabe
diff --git a/src/components/atomic-crm/providers/commons/attachments.ts b/src/components/atomic-crm/providers/commons/attachments.ts
new file mode 100644
index 00000000..8583fc61
--- /dev/null
+++ b/src/components/atomic-crm/providers/commons/attachments.ts
@@ -0,0 +1 @@
+export const ATTACHMENTS_BUCKET = "attachments";
diff --git a/src/components/atomic-crm/providers/supabase/dataProvider.ts b/src/components/atomic-crm/providers/supabase/dataProvider.ts
index 3c20e0ec..17be17c1 100644
--- a/src/components/atomic-crm/providers/supabase/dataProvider.ts
+++ b/src/components/atomic-crm/providers/supabase/dataProvider.ts
@@ -17,11 +17,10 @@ import type {
} from "../../types";
import type { ConfigurationContextValue } from "../../root/ConfigurationContext";
import { getActivityLog } from "../commons/activity";
+import { ATTACHMENTS_BUCKET } from "../commons/attachments";
import { getIsInitialized } from "./authProvider";
import { supabase } from "./supabase";
-const ATTACHMENTS_BUCKET = "attachments";
-
if (import.meta.env.VITE_SUPABASE_URL === undefined) {
throw new Error("Please set the VITE_SUPABASE_URL environment variable");
}
diff --git a/supabase/functions/delete_note_attachments/index.ts b/supabase/functions/delete_note_attachments/index.ts
index 0200dbb2..53510d73 100644
--- a/supabase/functions/delete_note_attachments/index.ts
+++ b/supabase/functions/delete_note_attachments/index.ts
@@ -1,8 +1,7 @@
import "jsr:@supabase/functions-js/edge-runtime.d.ts";
import { AuthMiddleware } from "../_shared/authentication.ts";
import { supabaseAdmin } from "../_shared/supabaseAdmin.ts";
-
-const ATTACHMENTS_BUCKET = "attachments";
+import { ATTACHMENTS_BUCKET } from "../../../src/components/atomic-crm/providers/commons/attachments.ts";
type NoteAttachment = {
path?: string | null;