diff --git a/src/controllers/insights.controller.ts b/src/controllers/insights.controller.ts index 7f1d90b..2718d34 100644 --- a/src/controllers/insights.controller.ts +++ b/src/controllers/insights.controller.ts @@ -1,11 +1,11 @@ -import insights from "../models/insights.model"; -import { Request, Response, NextFunction } from "express"; +import insights from '../models/insights.model'; +import { Request, Response, NextFunction } from 'express'; export const getTasksInsights = async (req: Request, res: Response, next: NextFunction) => { try { const { id: userID } = res.locals.user; const tasksInsights = await insights.getTasksInitiatedByMe(userID); - res.json({ message: "Tasks insights retrieved successfully.", insights: tasksInsights }); + res.json({ message: 'Tasks insights retrieved successfully.', insights: tasksInsights }); } catch (err) { res.locals.error = err; next(); diff --git a/src/models/insights.model.ts b/src/models/insights.model.ts index 07d1374..991c4bf 100644 --- a/src/models/insights.model.ts +++ b/src/models/insights.model.ts @@ -1,4 +1,4 @@ -import prisma from "../lib/database"; +import prisma from '../lib/database'; class insights { /** @@ -15,7 +15,7 @@ class insights { highPriorityTasks: await prisma.task.count({ where: { t_user_id: u_id, t_priority: 3 } }), mediumPriorityTasks: await prisma.task.count({ where: { t_user_id: u_id, t_priority: 2 } }), lowPriorityTasks: await prisma.task.count({ where: { t_user_id: u_id, t_priority: 1 } }) - } + }; insights.incompleteTasks = insights.allTasks - insights.completedTasks; return insights; } diff --git a/src/routes/api/insights.ts b/src/routes/api/insights.ts index e0132cd..fe7df37 100644 --- a/src/routes/api/insights.ts +++ b/src/routes/api/insights.ts @@ -5,6 +5,6 @@ import errorHandler from '../../middlewares/errorHandler.middleware'; const insightsRouter = (app: Application) => { app.get('/insights/tasks', authenticate, getTasksInsights, errorHandler); -} +}; export default insightsRouter;