-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from Vero-Ventures/33-add-get-request-to-retri…
…eve-the-total-number-of-job-postings Add Get request that returns the total number of job postings in each four front-end page
- Loading branch information
Showing
5 changed files
with
98 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { NextResponse } from 'next/server'; | ||
import { getTotalNumberOfPostings, handleError } from '../../siteRequestUtils'; | ||
|
||
export async function GET() { | ||
try { | ||
const siteCriteria = { site3: true }; | ||
|
||
let jobPostings = await getTotalNumberOfPostings(siteCriteria); | ||
|
||
if (jobPostings < 1) { | ||
return NextResponse.json( | ||
{ message: 'Not Found - No job postings found on this page' }, | ||
{ status: 404 } | ||
); | ||
} | ||
|
||
return NextResponse.json({ jobPostings }, { status: 200 }); | ||
} catch (error) { | ||
// Handle errors | ||
return handleError(error); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { NextResponse } from 'next/server'; | ||
import { getTotalNumberOfPostings, handleError } from '../../siteRequestUtils'; | ||
|
||
export async function GET() { | ||
try { | ||
const siteCriteria = { site1: true }; | ||
|
||
let jobPostings = await getTotalNumberOfPostings(siteCriteria); | ||
|
||
if (jobPostings < 1) { | ||
return NextResponse.json( | ||
{ message: 'Not Found - No job postings found on this page' }, | ||
{ status: 404 } | ||
); | ||
} | ||
|
||
return NextResponse.json({ jobPostings }, { status: 200 }); | ||
} catch (error) { | ||
// Handle errors | ||
return handleError(error); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { NextResponse } from 'next/server'; | ||
import { getTotalNumberOfPostings, handleError } from '../../siteRequestUtils'; | ||
|
||
export async function GET() { | ||
try { | ||
const siteCriteria = { site2: true }; | ||
|
||
let jobPostings = await getTotalNumberOfPostings(siteCriteria); | ||
|
||
if (jobPostings < 1) { | ||
return NextResponse.json( | ||
{ message: 'Not Found - No job postings found on this page' }, | ||
{ status: 404 } | ||
); | ||
} | ||
|
||
return NextResponse.json({ jobPostings }, { status: 200 }); | ||
} catch (error) { | ||
// Handle errors | ||
return handleError(error); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { NextResponse } from 'next/server'; | ||
import { getTotalNumberOfPostings, handleError } from '../../siteRequestUtils'; | ||
|
||
export async function GET() { | ||
try { | ||
const siteCriteria = { site4: true }; | ||
|
||
let jobPostings = await getTotalNumberOfPostings(siteCriteria); | ||
|
||
if (jobPostings < 1) { | ||
return NextResponse.json( | ||
{ message: 'Not Found - No job postings found on this page' }, | ||
{ status: 404 } | ||
); | ||
} | ||
|
||
return NextResponse.json({ jobPostings }, { status: 200 }); | ||
} catch (error) { | ||
// Handle errors | ||
return handleError(error); | ||
} | ||
} |