Brand Studio docs
Engineering manualAPI route source

/api/notifications/sweep

Exact current route handler: hosted-app/app/api/notifications/sweep/route.js

Methods: GET, POST. Input signals: none detected. Literal response-status signals: none detected.

Source: hosted-app/app/api/notifications/sweep/route.js. Imports: ../../../../lib/monitoring-sweep.mjs, ../../../../lib/notification-scheduler.mjs, ../../../../lib/supabase-rest.mjs, next/server. Exact source is shown for inspection; its presence does not prove authentication, validation or live behavior.

All API routes · API and execution contract

import { runMonitoringSweep } from "../../../../lib/monitoring-sweep.mjs";
import { NextResponse } from 'next/server';
import { supabaseConfigFromEnv } from '../../../../lib/supabase-rest.mjs';
import { authorizeNotificationSweep, runNotificationSweep } from '../../../../lib/notification-scheduler.mjs';
export const runtime = 'nodejs';
export const dynamic = 'force-dynamic';
export const maxDuration = 60;
async function sweep(request) {
  const auth = authorizeNotificationSweep(request);
  let result = { http_status: auth.http_status, body: { status: 'refused', reason: 'notification_worker_not_authorized' } };
  if (auth.ok) {
    try { const config = supabaseConfigFromEnv(process.env); result = await runMonitoringSweep({ lane: "notification", config, holder: "cron", run: () => runNotificationSweep({ config }) }); }
    catch { result = { http_status: 503, body: { status: 'refused', reason: 'notification_sweep_unconfirmed' } }; }
  }
  return NextResponse.json(result.body, { status: result.http_status, headers: { 'cache-control': 'no-store' } });
}
export const GET = sweep;
export const POST = sweep;