mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 20:13:49 +00:00
Add page count to api route header, update docs
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import validateRequest from '@/config/nextConnect/middleware/validateRequest';
|
||||
import DBClient from '@/prisma/DBClient';
|
||||
import getAllBeerPosts from '@/services/BeerPost/getAllBeerPosts';
|
||||
|
||||
import APIResponseValidationSchema from '@/validation/APIResponseValidationSchema';
|
||||
@@ -21,6 +22,9 @@ const getBeerPosts = async (
|
||||
const pageSize = parseInt(req.query.pageSize, 10);
|
||||
|
||||
const beerPosts = await getAllBeerPosts(pageNum, pageSize);
|
||||
const beerPostCount = await DBClient.instance.beerPost.count();
|
||||
|
||||
res.setHeader('X-Total-Count', beerPostCount);
|
||||
|
||||
res.status(200).json({
|
||||
message: 'Beer posts retrieved successfully',
|
||||
|
||||
Reference in New Issue
Block a user