import { NextResponse } from 'next/server';

import { withAuth } from '@/lib/api/helpers';
import { errorResponse } from '@/lib/errors';
import * as notificationsService from '@/lib/services/notifications.service';

export const POST = withAuth(async (_req, ctx) => {
  try {
    await notificationsService.markAllRead(ctx.userId, ctx.portId);
    return new NextResponse(null, { status: 204 });
  } catch (error) {
    return errorResponse(error);
  }
});
