23 lines
774 B
TypeScript
23 lines
774 B
TypeScript
import { NextRequest, NextResponse } from 'next/server'
|
|
|
|
import { listNotificationCenterRecipients } from '@/lib/notification-center-admin'
|
|
import {
|
|
requireNotificationCenterSuperAdmin,
|
|
toNotificationCenterAdminErrorResponse,
|
|
} from '../_shared'
|
|
|
|
export const runtime = 'nodejs'
|
|
export const dynamic = 'force-dynamic'
|
|
|
|
export async function GET(request: NextRequest) {
|
|
try {
|
|
const auth = await requireNotificationCenterSuperAdmin()
|
|
if ('response' in auth) return auth.response
|
|
|
|
const result = await listNotificationCenterRecipients(auth.actor, new URL(request.url).searchParams)
|
|
return NextResponse.json({ success: true, data: result.data }, { status: result.status })
|
|
} catch (error) {
|
|
return toNotificationCenterAdminErrorResponse(error)
|
|
}
|
|
}
|