feat: clone course (#582)

* feat: clone course work

* feat: clone and delete a course

* feat: clone and delete a course

* feat: clean up

* feat: attending to reviews

* feat: attended to revies
This commit is contained in:
Nwosu Emmanuel
2025-10-29 09:57:29 +01:00
committed by GitHub
parent f8271d850f
commit 8efffcb7f6
27 changed files with 900 additions and 382 deletions
+4 -9
View File
@@ -2,7 +2,7 @@ import { SupabaseClient, createClient } from '@supabase/supabase-js';
import { env } from '$src/config/env';
const { PUBLIC_SUPABASE_ANON_KEY, PUBLIC_SUPABASE_URL } = env;
const { PUBLIC_SUPABASE_ANON_KEY, PUBLIC_SUPABASE_URL, PRIVATE_SUPABASE_SERVICE_ROLE } = env;
export let supabase: SupabaseClient | null = null;
@@ -16,15 +16,9 @@ interface SupabaseConfig {
export function getSupabase(config?: SupabaseConfig): SupabaseClient {
if (supabase) return supabase;
const finalConfig = config ?? {
supabaseConfig: {
url: PUBLIC_SUPABASE_URL,
anonKey: PUBLIC_SUPABASE_ANON_KEY
}
};
try {
supabase = createClient(finalConfig.supabaseConfig.url, finalConfig.supabaseConfig.anonKey, {
// Use service role key to bypass RLS policies
supabase = createClient(PUBLIC_SUPABASE_URL, PRIVATE_SUPABASE_SERVICE_ROLE, {
auth: { persistSession: false }
});
} catch (error) {
@@ -34,3 +28,4 @@ export function getSupabase(config?: SupabaseConfig): SupabaseClient {
return supabase;
}