feat: add partner list and customer list explorer to admin settings
All checks were successful
Staging Build / build (push) Successful in 2m19s
All checks were successful
Staging Build / build (push) Successful in 2m19s
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
'use server'
|
||||
|
||||
import { createClient } from '@/lib/supabase/server'
|
||||
import { createAdminClient } from '@/lib/supabase/admin'
|
||||
import { revalidatePath } from 'next/cache'
|
||||
import type { EndCustomer } from '@/lib/types'
|
||||
|
||||
@@ -143,3 +144,15 @@ export async function anonymizeEndCustomer(id: string): Promise<void> {
|
||||
revalidatePath('/my-customers')
|
||||
revalidatePath(`/my-customers/${id}`)
|
||||
}
|
||||
|
||||
export async function getPartnerEndCustomers(partnerId: string): Promise<EndCustomer[]> {
|
||||
const admin = createAdminClient()
|
||||
const { data, error } = await admin
|
||||
.from('end_customers')
|
||||
.select('*')
|
||||
.eq('partner_id', partnerId)
|
||||
.order('company_name', { ascending: true })
|
||||
|
||||
if (error) throw error
|
||||
return data as EndCustomer[]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user