From 865497bf292cfb2b53030578aa8252e193a7505d Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Tue, 18 Jun 2024 14:07:24 +0700 Subject: [PATCH] feat: add product stats --- src/controllers/product/product-controller.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/controllers/product/product-controller.ts b/src/controllers/product/product-controller.ts index 68b3208..e37b989 100644 --- a/src/controllers/product/product-controller.ts +++ b/src/controllers/product/product-controller.ts @@ -56,6 +56,11 @@ function imageLocation(id: string) { @Route("api/v1/product") @Tags("Product") export class ProductController extends Controller { + @Get("stats") + async getProductStats(@Query() productTypeId?: string) { + return await prisma.product.count({ where: { productTypeId } }); + } + @Get() @Security("keycloak") async getProduct(