UNPKG

@gsb-core/core

Version:

GSB core services and classes for platform-independent web applications

75 lines (74 loc) 2.34 kB
import { GsbRole, GsbUser } from '../models/gsb-user.model'; /** * Service for managing Roles in the application */ export declare class RoleService { private entityService; private ENTITY_NAME; constructor(); /** * Get role by ID * @param id The role ID * @returns The role or null if not found */ getRoleById(id: string): Promise<GsbRole | null>; /** * Get all roles with pagination * @param page The page number (starting from 1) * @param pageSize The number of items per page * @returns An array of roles and the total count */ getRoles(page?: number, pageSize?: number): Promise<{ roles: GsbRole[]; totalCount: number; }>; /** * Search for roles * @param searchTerm The search term * @param page The page number (starting from 1) * @param pageSize The number of items per page * @returns An array of roles and the total count */ searchRoles(searchTerm: string, page?: number, pageSize?: number): Promise<{ roles: GsbRole[]; totalCount: number; }>; /** * Create a new role * @param role The role to create * @returns The created role ID or null if failed */ createRole(role: GsbRole): Promise<string | null>; /** * Update an existing role * @param role The role to update * @returns True if updated successfully, false otherwise */ updateRole(role: GsbRole): Promise<boolean>; /** * Delete a role * @param id The role ID to delete * @returns True if deleted successfully, false otherwise */ deleteRole(id: string): Promise<boolean>; /** * Get users in a role * @param roleId The role ID * @returns Array of users in the role */ getUsersInRole(roleId: string): Promise<GsbUser[]>; /** * Add a user to a role * @param roleId The role ID * @param userId The user ID * @returns True if added successfully, false otherwise */ addUserToRole(roleId: string, userId: string): Promise<boolean>; /** * Remove a user from a role * @param roleId The role ID * @param userId The user ID * @returns True if removed successfully, false otherwise */ removeUserFromRole(roleId: string, userId: string): Promise<boolean>; }