New Base func
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
import { createClient } from '@/lib/supabase/server'
|
||||
import { NextResponse } from 'next/server'
|
||||
import type { CreateCustomerInput } from '@/types'
|
||||
import { eventBus } from '@/lib/events'
|
||||
import { ensureInitialized } from '@/lib/init'
|
||||
import type { CreateCustomerInput, Customer } from '@/types'
|
||||
|
||||
ensureInitialized()
|
||||
|
||||
export async function GET() {
|
||||
const supabase = await createClient()
|
||||
@@ -60,5 +64,10 @@ export async function POST(request: Request) {
|
||||
return NextResponse.json({ error: error.message }, { status: 500 })
|
||||
}
|
||||
|
||||
await eventBus.emit({
|
||||
type: 'customer.created',
|
||||
payload: { customer: data as Customer, userId: user.id },
|
||||
})
|
||||
|
||||
return NextResponse.json({ data })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user