Skip to content

Commit

Permalink
Prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
ab-elhaddad committed Oct 13, 2023
1 parent 686ce54 commit 7ed443e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/controllers/insights.controller.ts
Original file line number Diff line number Diff line change
@@ -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();
Expand Down
4 changes: 2 additions & 2 deletions src/models/insights.model.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import prisma from "../lib/database";
import prisma from '../lib/database';

class insights {
/**
Expand All @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/routes/api/insights.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ import errorHandler from '../../middlewares/errorHandler.middleware';

const insightsRouter = (app: Application) => {
app.get('/insights/tasks', authenticate, getTasksInsights, errorHandler);
}
};

export default insightsRouter;

0 comments on commit 7ed443e

Please sign in to comment.