mirror of
https://github.com/rgrgogu/new_starr.git
synced 2026-09-27 00:12:54 +08:00
@@ -77,23 +77,11 @@ exports.getGroupsDashboard = async (req, res) => {
|
||||
totalGroups,
|
||||
activeGroups,
|
||||
archivedGroups,
|
||||
emptyGroups,
|
||||
memberCountBreakdown,
|
||||
] = await Promise.all([
|
||||
mdl_UserGroups.count({ paranoid: false }),
|
||||
mdl_UserGroups.count({ where: { is_active: true } }),
|
||||
mdl_UserGroups.count({ where: { deletedAt: { [Op.ne]: null } }, paranoid: false }),
|
||||
mdl_UserGroups.count({
|
||||
where: { is_active: true },
|
||||
include: [{
|
||||
model: mdl_UserGroupMembers,
|
||||
required: false,
|
||||
where: { deletedAt: null },
|
||||
}],
|
||||
having: literal('COUNT("UserGroupMembers"."user_id") = 0'),
|
||||
group: ['UserGroup.group_id'],
|
||||
subQuery: false,
|
||||
}).catch(() => 0),
|
||||
mdl_UserGroupMembers.findAll({
|
||||
attributes: [
|
||||
'group_id',
|
||||
@@ -121,8 +109,6 @@ exports.getGroupsDashboard = async (req, res) => {
|
||||
{ key: 'total', label: 'Total Groups', value: totalGroups },
|
||||
{ key: 'active', label: 'Active Groups', value: activeGroups },
|
||||
{ key: 'inactive', label: 'Inactive Groups', value: totalGroups - archivedGroups - activeGroups },
|
||||
{ key: 'archived', label: 'Archived', value: archivedGroups },
|
||||
{ key: 'empty', label: 'Empty Groups', value: Array.isArray(emptyGroups) ? emptyGroups.length : emptyGroups },
|
||||
],
|
||||
breakdowns: [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user