feat: stat by userType
This commit is contained in:
parent
eacb225ffe
commit
875f7ae023
1 changed files with 5 additions and 4 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import { Prisma, Status } from "@prisma/client";
|
||||
import { Prisma, Status, UserType } from "@prisma/client";
|
||||
import {
|
||||
Body,
|
||||
Controller,
|
||||
|
|
@ -61,11 +61,12 @@ type BranchUpdate = {
|
|||
@Tags("Branch")
|
||||
@Security("keycloak")
|
||||
export class BranchController extends Controller {
|
||||
@Get("stats")
|
||||
async getStat() {
|
||||
@Get("user-stats")
|
||||
async getUserStat(@Query() userType?: UserType) {
|
||||
const list = await prisma.branchUser.groupBy({
|
||||
by: ["branchId"],
|
||||
_count: true,
|
||||
where: { user: { userType } },
|
||||
by: "branchId",
|
||||
});
|
||||
|
||||
const record = await prisma.branch.findMany({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue