Made the service functions reusable for both query as well as page permissions

This commit is contained in:
devanshu052000 2025-05-21 15:55:02 +05:30
parent b13a8ca376
commit 82eb0204c2
4 changed files with 22 additions and 9 deletions

@ -1 +1 @@
Subproject commit 0f2e1e5905e4a731b45f962983aa5eff745c0b35
Subproject commit c1d051b04364f9a2db333b3cffb77d611d50c8eb

View file

@ -4,6 +4,12 @@ export enum PAGE_PERMISSION_TYPE {
ALL = 'ALL',
}
export enum PERMISSION_ENTITY_TYPE {
PAGE = 'PAGE',
QUERY = 'QUERY',
COMPONENT = 'COMPONENT',
}
export enum FEATURE_KEY {
FETCH_USERS = 'fetch_users',
FETCH_USER_GROUPS = 'fetch_user_groups',

View file

@ -1,16 +1,23 @@
import { User } from '@entities/user.entity';
import { CreatePagePermissionDto } from '../dto';
import { PERMISSION_ENTITY_TYPE } from '../constants';
export interface IAppPermissionsService {
fetchUsers(appId: string, user: User): Promise<any>;
fetchUserGroups(appId: string, user: User): Promise<any>;
fetchPagePermissions(pageId: string): Promise<any>;
fetchAppPermissions(type: PERMISSION_ENTITY_TYPE, pageId: string): Promise<any>;
createPagePermissions(pageId: string, body: CreatePagePermissionDto): Promise<any>;
createAppPermissions(type: PERMISSION_ENTITY_TYPE, pageId: string, body: CreatePagePermissionDto): Promise<any>;
updatePagePermissions(appId: string, pageId: string, body: CreatePagePermissionDto, user: User): Promise<any>;
updateAppPermissions(
type: PERMISSION_ENTITY_TYPE,
appId: string,
pageId: string,
body: CreatePagePermissionDto,
user: User
): Promise<any>;
deletePagePermissions(pageId: string): Promise<any>;
deleteAppPermissions(type: PERMISSION_ENTITY_TYPE, pageId: string): Promise<any>;
}

View file

@ -13,19 +13,19 @@ export class AppPermissionsService implements IAppPermissionsService {
throw new Error('Method not implemented.');
}
async fetchPagePermissions(pageId) {
async fetchAppPermissions(type, pageId) {
throw new Error('Method not implemented.');
}
async createPagePermissions(pageId, body) {
async createAppPermissions(type, pageId, body) {
throw new Error('Method not implemented.');
}
async updatePagePermissions(appId, pageId, body, user) {
async updateAppPermissions(type, appId, pageId, body, user) {
throw new Error('Method not implemented.');
}
async deletePagePermissions(pageId) {
async deleteAppPermissions(type, pageId) {
throw new Error('Method not implemented.');
}
}