notification about emails in company card

This commit is contained in:
richardtekula
2025-11-26 07:35:55 +01:00
parent 879709661e
commit 947d1d9b99
3 changed files with 59 additions and 1 deletions

View File

@@ -69,6 +69,25 @@ export const getCompanyEmailThreads = async (req, res) => {
}
};
/**
* Get unread email counts grouped by company for current user
* GET /api/companies/email-unread
*/
export const getCompanyUnreadCounts = async (req, res) => {
try {
const userId = req.userId;
const counts = await companyEmailService.getCompanyUnreadCounts(userId);
res.status(200).json({
success: true,
data: counts,
});
} catch (error) {
const errorResponse = formatErrorResponse(error, process.env.NODE_ENV === 'development');
res.status(error.statusCode || 500).json(errorResponse);
}
};
/**
* Get company with relations (projects, todos, notes)
* GET /api/companies/:companyId/details