feat(db): phase 4 group 1 — lib/ settings + notifications to Drizzle
Convert lib/settings.ts, lib/notifications/{in-app,email,capa-escalation,
effectiveness-recheck}.ts from Supabase PostgREST to Drizzle asAdmin queries.
Drop supabase arg from all call sites in app/api/ and cron routes. Rewrite
notification unit tests to mock @/lib/db/with-user instead of SupabaseClient.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2,7 +2,6 @@ export const dynamic = 'force-dynamic'
|
||||
|
||||
import { timingSafeEqual } from 'crypto'
|
||||
import { NextRequest, NextResponse } from 'next/server'
|
||||
import { createClient } from '@/lib/supabase/server'
|
||||
import { escalateOverdueCapa } from '@/lib/notifications/capa-escalation'
|
||||
|
||||
export async function GET(request: NextRequest) {
|
||||
@@ -15,7 +14,6 @@ export async function GET(request: NextRequest) {
|
||||
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 })
|
||||
}
|
||||
|
||||
const supabase = await createClient()
|
||||
const { notified } = await escalateOverdueCapa(supabase)
|
||||
const { notified } = await escalateOverdueCapa()
|
||||
return NextResponse.json({ ok: true, notified })
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ export const dynamic = 'force-dynamic'
|
||||
|
||||
import { timingSafeEqual } from 'crypto'
|
||||
import { NextRequest, NextResponse } from 'next/server'
|
||||
import { createClient } from '@/lib/supabase/server'
|
||||
import { sendEffectivenessRecheckNotifications } from '@/lib/notifications/effectiveness-recheck'
|
||||
|
||||
export async function GET(request: NextRequest) {
|
||||
@@ -15,7 +14,6 @@ export async function GET(request: NextRequest) {
|
||||
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 })
|
||||
}
|
||||
|
||||
const supabase = await createClient()
|
||||
const { notified } = await sendEffectivenessRecheckNotifications(supabase)
|
||||
const { notified } = await sendEffectivenessRecheckNotifications()
|
||||
return NextResponse.json({ ok: true, notified })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user