fix issues

This commit is contained in:
wass08
2026-02-11 17:20:11 +09:00
parent 92f1c065f8
commit 2332906e99
5 changed files with 15 additions and 21 deletions
@@ -1,9 +1,8 @@
/** /**
* Supabase server client for database access * Supabase server client for database access
* Re-exports from @pascal-app/db package
*/ */
import { supabaseAdmin } from '@pascal-app/db/server' import { supabaseAdmin } from '@/lib/supabase/server'
/** /**
* Create a Supabase client for server-side use with service role key * Create a Supabase client for server-side use with service role key
@@ -1,5 +1,5 @@
import { createClient } from '@supabase/supabase-js' import { createClient } from '@supabase/supabase-js'
import type { Database } from './types' import type { SupabaseDatabase } from '@pascal-app/db'
const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL! const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL!
const supabaseAnonKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY! const supabaseAnonKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!
@@ -8,4 +8,4 @@ const supabaseAnonKey = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!
* Supabase client for client-side use with anon key * Supabase client for client-side use with anon key
* Uses Row Level Security (RLS) policies * Uses Row Level Security (RLS) policies
*/ */
export const supabase = createClient<Database>(supabaseUrl, supabaseAnonKey) export const supabase = createClient<SupabaseDatabase>(supabaseUrl, supabaseAnonKey)
@@ -1,5 +1,5 @@
import { createClient } from '@supabase/supabase-js' import { createClient } from '@supabase/supabase-js'
import type { Database } from './types' import type { SupabaseDatabase } from '@pascal-app/db'
const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL! const supabaseUrl = process.env.NEXT_PUBLIC_SUPABASE_URL!
const supabaseServiceRoleKey = process.env.SUPABASE_SERVICE_ROLE_KEY! const supabaseServiceRoleKey = process.env.SUPABASE_SERVICE_ROLE_KEY!
@@ -9,9 +9,13 @@ const supabaseServiceRoleKey = process.env.SUPABASE_SERVICE_ROLE_KEY!
* Bypasses Row Level Security (RLS) - use with caution * Bypasses Row Level Security (RLS) - use with caution
* Always filter by user_id to enforce permissions * Always filter by user_id to enforce permissions
*/ */
export const supabaseAdmin = createClient<Database>(supabaseUrl, supabaseServiceRoleKey, { export const supabaseAdmin = createClient<SupabaseDatabase>(
auth: { supabaseUrl,
persistSession: false, supabaseServiceRoleKey,
autoRefreshToken: false, {
auth: {
persistSession: false,
autoRefreshToken: false,
},
}, },
}) )
-8
View File
@@ -7,14 +7,6 @@
"types": "./src/index.ts", "types": "./src/index.ts",
"default": "./src/index.ts" "default": "./src/index.ts"
}, },
"./client": {
"types": "./src/client.ts",
"default": "./src/client.ts"
},
"./server": {
"types": "./src/server.ts",
"default": "./src/server.ts"
},
"./types": { "./types": {
"types": "./src/types.ts", "types": "./src/types.ts",
"default": "./src/types.ts" "default": "./src/types.ts"
+2 -3
View File
@@ -1,10 +1,9 @@
/** /**
* Database package * Database package
* Exports Supabase clients, Drizzle ORM, and types * Exports Drizzle ORM and types
* Note: Supabase clients are kept in the app's lib directory to avoid build-time initialization
*/ */
export { supabase } from './client'
export { supabaseAdmin } from './server'
export type { Database as SupabaseDatabase } from './types' export type { Database as SupabaseDatabase } from './types'
// Drizzle exports // Drizzle exports