Extract upload middleware to separate file and implement edit profile functionality.
This commit is contained in:
Aaron William Po
2023-12-01 00:23:30 -05:00
parent 0c09db24a7
commit ab252c41b9
8 changed files with 319 additions and 58 deletions

View File

@@ -18,11 +18,14 @@ const getAllBeersByBrewery = async (
// eslint-disable-next-line @typescript-eslint/naming-convention
const { page_size, page_num, id } = req.query;
const pageNum = parseInt(page_num, 10);
const pageSize = parseInt(page_size, 10);
const beers: z.infer<typeof BeerPostQueryResult>[] =
await DBClient.instance.beerPost.findMany({
where: { breweryId: id },
take: parseInt(page_size, 10),
skip: parseInt(page_num, 10) * parseInt(page_size, 10),
skip: (pageNum - 1) * pageSize,
take: pageSize,
select: {
id: true,
name: true,