mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 18:52:06 +00:00
fix: use term 'count' for X-Total-Count header
This commit is contained in:
@@ -59,9 +59,9 @@ const getAll = async (
|
|||||||
pageSize: parseInt(page_size, 10),
|
pageSize: parseInt(page_size, 10),
|
||||||
});
|
});
|
||||||
|
|
||||||
const pageCount = await DBClient.instance.beerComment.count({ where: { beerPostId } });
|
const count = await DBClient.instance.beerComment.count({ where: { beerPostId } });
|
||||||
|
|
||||||
res.setHeader('X-Total-Count', pageCount);
|
res.setHeader('X-Total-Count', count);
|
||||||
|
|
||||||
res.status(200).json({
|
res.status(200).json({
|
||||||
message: 'Beer comments fetched successfully',
|
message: 'Beer comments fetched successfully',
|
||||||
|
|||||||
@@ -25,9 +25,9 @@ const getAllBeersByBeerStyle = async (
|
|||||||
styleId: id,
|
styleId: id,
|
||||||
});
|
});
|
||||||
|
|
||||||
const pageCount = await DBClient.instance.beerPost.count({ where: { styleId: id } });
|
const count = await DBClient.instance.beerPost.count({ where: { styleId: id } });
|
||||||
|
|
||||||
res.setHeader('X-Total-Count', pageCount);
|
res.setHeader('X-Total-Count', count);
|
||||||
|
|
||||||
res.status(200).json({
|
res.status(200).json({
|
||||||
message: 'Beers fetched successfully',
|
message: 'Beers fetched successfully',
|
||||||
|
|||||||
@@ -59,11 +59,11 @@ const getAll = async (
|
|||||||
pageSize: parseInt(page_size, 10),
|
pageSize: parseInt(page_size, 10),
|
||||||
});
|
});
|
||||||
|
|
||||||
const pageCount = await DBClient.instance.beerStyleComment.count({
|
const count = await DBClient.instance.beerStyleComment.count({
|
||||||
where: { beerStyleId },
|
where: { beerStyleId },
|
||||||
});
|
});
|
||||||
|
|
||||||
res.setHeader('X-Total-Count', pageCount);
|
res.setHeader('X-Total-Count', count);
|
||||||
|
|
||||||
res.status(200).json({
|
res.status(200).json({
|
||||||
message: 'Beer comments fetched successfully',
|
message: 'Beer comments fetched successfully',
|
||||||
|
|||||||
@@ -47,11 +47,11 @@ const getAllBeersByBrewery = async (
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const pageCount = await DBClient.instance.beerPost.count({
|
const count = await DBClient.instance.beerPost.count({
|
||||||
where: { breweryId: id },
|
where: { breweryId: id },
|
||||||
});
|
});
|
||||||
|
|
||||||
res.setHeader('X-Total-Count', pageCount);
|
res.setHeader('X-Total-Count', count);
|
||||||
|
|
||||||
res.status(200).json({
|
res.status(200).json({
|
||||||
message: 'Beers fetched successfully',
|
message: 'Beers fetched successfully',
|
||||||
|
|||||||
@@ -67,11 +67,11 @@ const getAll = async (
|
|||||||
pageSize: parseInt(page_size, 10),
|
pageSize: parseInt(page_size, 10),
|
||||||
});
|
});
|
||||||
|
|
||||||
const pageCount = await DBClient.instance.breweryComment.count({
|
const count = await DBClient.instance.breweryComment.count({
|
||||||
where: { breweryPostId },
|
where: { breweryPostId },
|
||||||
});
|
});
|
||||||
|
|
||||||
res.setHeader('X-Total-Count', pageCount);
|
res.setHeader('X-Total-Count', count);
|
||||||
|
|
||||||
res.status(200).json({
|
res.status(200).json({
|
||||||
message: 'Beer comments fetched successfully',
|
message: 'Beer comments fetched successfully',
|
||||||
|
|||||||
Reference in New Issue
Block a user