diff --git a/src/controllers/user-controller.ts b/src/controllers/user-controller.ts index 6dd2c93..86e4afd 100644 --- a/src/controllers/user-controller.ts +++ b/src/controllers/user-controller.ts @@ -104,6 +104,27 @@ function imageLocation(id: string) { @Tags("User") @Security("keycloak") export class UserController extends Controller { + @Get("type-stats") + async getUserTypeStats() { + const list = await prisma.user.groupBy({ + by: "userType", + _count: true, + }); + + return list.reduce>( + (a, c) => { + a[c.userType] = c._count; + return a; + }, + { + USER: 0, + MESSENGER: 0, + DELEGATE: 0, + AGENCY: 0, + }, + ); + } + @Get() async getUser( @Query() userType?: UserType,