mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-23 08:58:26 +00:00
Added response type for getAll Users
This commit is contained in:
parent
7b2d637374
commit
826293b0f8
2 changed files with 17 additions and 3 deletions
|
|
@ -1,3 +1,4 @@
|
|||
import { GroupPermissions } from 'src/entities/group_permissions.entity';
|
||||
import { GROUP_PERMISSIONS_TYPE, USER_ROLE } from '../constants/group-permissions.constant';
|
||||
import { SearchParamItem } from '@helpers/db-utility/db-utility.interface';
|
||||
|
||||
|
|
@ -26,3 +27,8 @@ export interface AddUserRoleObject {
|
|||
role: USER_ROLE;
|
||||
userId: string;
|
||||
}
|
||||
|
||||
export interface GetUsersResponse {
|
||||
groupPermissions: GroupPermissions[];
|
||||
length: number;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,10 @@ import {
|
|||
} from '@module/user_resource_permissions/constants/group-permissions.constant';
|
||||
import { dbTransactionWrap, catchDbException } from 'src/helpers/utils.helper';
|
||||
import { EntityManager, getManager } from 'typeorm';
|
||||
import { CreateDefaultGroupObject } from '@module/user_resource_permissions/interface/group-permissions.interface';
|
||||
import {
|
||||
CreateDefaultGroupObject,
|
||||
GetUsersResponse,
|
||||
} from '@module/user_resource_permissions/interface/group-permissions.interface';
|
||||
import { GroupUsers } from 'src/entities/group_users.entity';
|
||||
import { GranularPermissionsService } from './granular_permissions.service';
|
||||
import {
|
||||
|
|
@ -50,12 +53,17 @@ export class GroupPermissionsServiceV2 {
|
|||
}, manager);
|
||||
}
|
||||
|
||||
async getAllGroup(organizationId: string) {
|
||||
async getAllGroup(organizationId: string): Promise<GetUsersResponse> {
|
||||
const manager: EntityManager = getManager();
|
||||
return await manager.findAndCount(GroupPermissions, {
|
||||
const result = await manager.findAndCount(GroupPermissions, {
|
||||
where: { organizationId },
|
||||
order: { type: 'DESC' },
|
||||
});
|
||||
const response: GetUsersResponse = {
|
||||
groupPermissions: result[0],
|
||||
length: result[1],
|
||||
};
|
||||
return response;
|
||||
}
|
||||
|
||||
async getGroup(id: string, manager?: EntityManager): Promise<GroupPermissions> {
|
||||
|
|
|
|||
Loading…
Reference in a new issue