From 04de396c904f95e0331c2ed330442db72e68bcc9 Mon Sep 17 00:00:00 2001 From: Claudio Poli Date: Mon, 29 May 2023 07:06:03 +0200 Subject: [PATCH] feat(route.ts): add check for paused project, refs https://github.com/icoretech/airbroke/issues/52 --- app/api/v3/notices/route.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/api/v3/notices/route.ts b/app/api/v3/notices/route.ts index 3fa2a37b..8808b602 100644 --- a/app/api/v3/notices/route.ts +++ b/app/api/v3/notices/route.ts @@ -61,12 +61,12 @@ async function POST(request: NextRequest) { const { projectKey, requestType } = extractProjectKeyFromRequest(request); const project = await prisma.project.findFirst({ where: { api_key: projectKey } }); - if (!project) { + if (!project || project.paused) { if (requestType === 'params') { - const json_response = { error: '**Airbroke: Project not found' }; + const json_response = { error: '**Airbroke: Project not found or paused' }; return NextResponse.json(json_response, { status: 404 }); } else { - const json_response = { error: '**Airbroke: Project not found' }; + const json_response = { error: '**Airbroke: Project not found or paused' }; const headers = { 'WWW-Authenticate': `Bearer realm="Airbroke"` }; return NextResponse.json(json_response, { status: 404, headers }); }