Merge branch 'mayank' of http://git.wdipl.com/Mayank.Mishra/MinglarBackendNestJS into paritosh
This commit is contained in:
@@ -433,6 +433,53 @@ export class MinglarService {
|
||||
accountManager: host.accountManager || null
|
||||
}));
|
||||
}
|
||||
async getAllCoadminAndAM() {
|
||||
return await this.prisma.user.findMany({
|
||||
where: {
|
||||
roleXid: {
|
||||
in: [ROLE.CO_ADMIN, ROLE.ACCOUNT_MANAGER]
|
||||
},
|
||||
isActive: true,
|
||||
|
||||
// 🔥 Filter users who have at least ONE accepted invitation
|
||||
inviteDetails: {
|
||||
some: {
|
||||
isMinglarInvitation: true,
|
||||
is_accepted: true,
|
||||
invitation_status: MINGLAR_INVITATION_STATUS.ACCEPTED,
|
||||
isActive: true
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
include: {
|
||||
role: {
|
||||
select: {
|
||||
id: true,
|
||||
roleName: true,
|
||||
},
|
||||
},
|
||||
|
||||
// (Optional) to return only the accepted invitations
|
||||
// inviteDetails: {
|
||||
// where: {
|
||||
// isMinglarInvitation: true,
|
||||
// is_accepted: true,
|
||||
// invitation_status: MINGLAR_INVITATION_STATUS.ACCEPTED,
|
||||
// isActive: true
|
||||
// },
|
||||
// select: {
|
||||
// id: true,
|
||||
// invitedBy: true,
|
||||
// invited_on: true,
|
||||
// invitation_status: true,
|
||||
// is_accepted: true
|
||||
// }
|
||||
// }
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user