File size: 552 Bytes
18b71c5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { NextFunction, Request, Response } from "express";
import { dashboardService } from "../services/dashboard.service";
import { AppError } from "../utils/appError";

export const dashboardController = {
  overview(request: Request, response: Response, next: NextFunction) {
    try {
      if (!request.authUserId) {
        throw new AppError("Unauthorized.", 401);
      }

      const data = dashboardService.getOverview(request.authUserId);
      response.json({ success: true, data });
    } catch (error) {
      next(error);
    }
  },
};