From c7aec4559284a394b06cb006883378e9d4c2a4cf Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Tue, 11 Jun 2024 09:27:37 +0700 Subject: [PATCH] feat: count data --- src/controllers/product/group-controller.ts | 5 +++++ src/controllers/product/type-controller.ts | 5 +++++ src/controllers/service/service-controller.ts | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/src/controllers/product/group-controller.ts b/src/controllers/product/group-controller.ts index d480c22..e5b3ef1 100644 --- a/src/controllers/product/group-controller.ts +++ b/src/controllers/product/group-controller.ts @@ -37,6 +37,11 @@ type ProductGroupUpdate = { @Tags("Product Group") @Security("keycloak") export class ProductGroup extends Controller { + @Get() + async getProductGroupStats() { + return await prisma.productGroup.count(); + } + @Get() async getProductGroup(@Query() query: string = "") { const where = { diff --git a/src/controllers/product/type-controller.ts b/src/controllers/product/type-controller.ts index 14a7e6b..87611d7 100644 --- a/src/controllers/product/type-controller.ts +++ b/src/controllers/product/type-controller.ts @@ -37,6 +37,11 @@ type ProductTypeUpdate = { @Tags("Product Type") @Security("keycloak") export class ProductType extends Controller { + @Get() + async getProductTypeStats() { + return await prisma.productType.count(); + } + @Get() async getProductType(@Query() query: string = "") { const where = { diff --git a/src/controllers/service/service-controller.ts b/src/controllers/service/service-controller.ts index b6391f0..a2a5ca8 100644 --- a/src/controllers/service/service-controller.ts +++ b/src/controllers/service/service-controller.ts @@ -46,6 +46,11 @@ function imageLocation(id: string) { @Tags("Service") @Security("keycloak") export class ServiceController extends Controller { + @Get() + async getServiceStats() { + return await prisma.service.count(); + } + @Get() async getService( @Query() query: string = "",