Skip to content

Commit

Permalink
feat(route.ts): add check for paused project, refs #52
Browse files Browse the repository at this point in the history
  • Loading branch information
masterkain committed May 29, 2023
1 parent d71c7ad commit 04de396
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/api/v3/notices/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
}
Expand Down

0 comments on commit 04de396

Please sign in to comment.