migration fix (#13156)

This commit is contained in:
Rohan Lahori 2025-07-02 17:42:41 +05:30 committed by GitHub
parent 6aec215e96
commit f56ea9292b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -274,6 +274,29 @@ export class LicenseCountsService implements ILicenseCountsService {
manager
);
}
async getUserIdWithEndUserRole(manager: EntityManager): Promise<string[]> {
const statusList = [WORKSPACE_USER_STATUS.INVITED, WORKSPACE_USER_STATUS.ACTIVE];
const users = await manager.find(User, {
select: ['id'],
where: {
status: Not(USER_STATUS.ARCHIVED),
organizationUsers: {
status: In(statusList),
},
userPermissions: {
name: USER_ROLE.END_USER,
organization: {
status: WORKSPACE_STATUS.ACTIVE,
},
},
},
relations: ['organizationUsers', 'userPermissions', 'userPermissions.organization'],
});
// Extract unique user IDs
return [...new Set(users.map((user) => user.id))];
}
async fetchTotalAppCount(organizationId: string, manager: EntityManager): Promise<number> {
if (getTooljetEdition() !== TOOLJET_EDITIONS.Cloud) {