team member login get all issues display

master^2
Bhaskar 5 months ago
parent f25cf11e8d
commit 787cdc1e7d

@ -4259,3 +4259,31 @@ exports.assignCategorizeIssue = async (request, reply) => {
return reply.send({ message: 'Issue assigned successfully', issue }); return reply.send({ message: 'Issue assigned successfully', issue });
}; };
exports.getCategorizedIssue = async (request, reply) => {
const { support_teamMemberId } = request.params;
const supports = await Support.aggregate([
{ $unwind: '$categorizedIssues' },
{ $match: { 'categorizedIssues.assignedTo.support_teamMemberId': support_teamMemberId } },
{
$group: {
_id: '$_id',
supportId: { $first: '$supportId' },
categorizedIssues: { $push: '$categorizedIssues' }
}
}
]);
if (supports.length === 0) {
return reply.code(404).send({ message: 'No categorized issues assigned to this team member.' });
}
return reply.send({
supportId: supports[0].supportId,
categorizedIssues: supports[0].categorizedIssues
});
};

@ -725,6 +725,24 @@ module.exports = function (fastify, opts, next) {
}, },
handler: installationController.assignCategorizeIssue handler: installationController.assignCategorizeIssue
}); });
fastify.post("/api/my-categorized-issues/:support_teamMemberId", {
schema: {
description: "Get the categorized issues on particular team member",
tags: ["Support"],
summary: "Get the categorized issues on particular team member",
params: {
type: "object",
required: ["support_teamMemberId"],
properties: {
support_teamMemberId: { type: "string" },
},
},
},
handler: installationController.getCategorizedIssue
});
next(); next();
} }
Loading…
Cancel
Save