24 lines
790 B
TypeScript
24 lines
790 B
TypeScript
import { NextRequest, NextResponse } from 'next/server'
|
|
|
|
import { sendNotificationCenterTest } from '@/lib/notification-center-admin'
|
|
import {
|
|
requireNotificationCenterSuperAdmin,
|
|
toNotificationCenterAdminErrorResponse,
|
|
} from '../_shared'
|
|
|
|
export const runtime = 'nodejs'
|
|
export const dynamic = 'force-dynamic'
|
|
|
|
export async function POST(request: NextRequest) {
|
|
try {
|
|
const auth = await requireNotificationCenterSuperAdmin()
|
|
if ('response' in auth) return auth.response
|
|
|
|
const body = await request.json().catch(() => ({}))
|
|
const result = await sendNotificationCenterTest(auth.actor, body)
|
|
return NextResponse.json({ success: true, data: result.data }, { status: result.status })
|
|
} catch (error) {
|
|
return toNotificationCenterAdminErrorResponse(error)
|
|
}
|
|
}
|