ФУНКЦИИ - МЕЖПРОЕКТНАЯ КОММУНИКАЦИЯ: администрирование воркспейсов и feature-gates в God Mode
This commit is contained in:
@@ -5,7 +5,13 @@
|
||||
*/
|
||||
|
||||
import { API_BASE_URL } from "@plane/constants";
|
||||
import type { IWorkspace, TWorkspacePaginationInfo } from "@plane/types";
|
||||
import type {
|
||||
IWorkspace,
|
||||
TInstanceWorkspaceFeatureKey,
|
||||
TInstanceWorkspaceFeaturesResponse,
|
||||
TInstanceWorkspaceMember,
|
||||
TWorkspacePaginationInfo,
|
||||
} from "@plane/types";
|
||||
import { APIService } from "../api.service";
|
||||
|
||||
/**
|
||||
@@ -68,4 +74,55 @@ export class InstanceWorkspaceService extends APIService {
|
||||
throw error?.response?.data;
|
||||
});
|
||||
}
|
||||
|
||||
async listMembers(workspaceId: string): Promise<TInstanceWorkspaceMember[]> {
|
||||
return this.get(`/api/instances/workspaces/${workspaceId}/members/`)
|
||||
.then((response) => response?.data)
|
||||
.catch((error) => {
|
||||
throw error?.response?.data;
|
||||
});
|
||||
}
|
||||
|
||||
async updateMemberRole(
|
||||
workspaceId: string,
|
||||
workspaceMemberId: string,
|
||||
role: TInstanceWorkspaceMember["role"]
|
||||
): Promise<TInstanceWorkspaceMember> {
|
||||
return this.patch(`/api/instances/workspaces/${workspaceId}/members/${workspaceMemberId}/`, { role })
|
||||
.then((response) => response?.data)
|
||||
.catch((error) => {
|
||||
throw error?.response?.data;
|
||||
});
|
||||
}
|
||||
|
||||
async removeMember(workspaceId: string, workspaceMemberId: string): Promise<void> {
|
||||
return this.delete(`/api/instances/workspaces/${workspaceId}/members/${workspaceMemberId}/`)
|
||||
.then((response) => response?.data)
|
||||
.catch((error) => {
|
||||
throw error?.response?.data;
|
||||
});
|
||||
}
|
||||
|
||||
async retrieveFeatures(workspaceId: string): Promise<TInstanceWorkspaceFeaturesResponse> {
|
||||
return this.get(`/api/instances/workspaces/${workspaceId}/features/`)
|
||||
.then((response) => response?.data)
|
||||
.catch((error) => {
|
||||
throw error?.response?.data;
|
||||
});
|
||||
}
|
||||
|
||||
async updateFeature(
|
||||
workspaceId: string,
|
||||
featureKey: TInstanceWorkspaceFeatureKey,
|
||||
isEnabled: boolean
|
||||
): Promise<TInstanceWorkspaceFeaturesResponse> {
|
||||
return this.patch(`/api/instances/workspaces/${workspaceId}/features/`, {
|
||||
feature_key: featureKey,
|
||||
is_enabled: isEnabled,
|
||||
})
|
||||
.then((response) => response?.data)
|
||||
.catch((error) => {
|
||||
throw error?.response?.data;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ export type TWorkspaceAICredentialStatus = {
|
||||
export type TWorkspaceAISettings = {
|
||||
id: string;
|
||||
workspace_id: string;
|
||||
feature_entitlement_enabled: boolean;
|
||||
voice_tasker_enabled: boolean;
|
||||
provider: TWorkspaceAIProvider;
|
||||
transcription_model: string;
|
||||
|
||||
@@ -96,6 +96,27 @@ export interface IWorkspaceMember {
|
||||
is_active?: boolean;
|
||||
}
|
||||
|
||||
export type TInstanceWorkspaceMember = IWorkspaceMember & {
|
||||
active_project_count: number;
|
||||
admin_project_count: number;
|
||||
};
|
||||
|
||||
export type TInstanceWorkspaceFeatureKey = "voice_tasker";
|
||||
|
||||
export type TInstanceWorkspaceFeature = {
|
||||
key: TInstanceWorkspaceFeatureKey;
|
||||
title: string;
|
||||
description: string;
|
||||
is_enabled: boolean;
|
||||
workspace_setting_enabled: boolean;
|
||||
access_mode: "all_workspace_members" | "admins_only" | "selected_projects" | "selected_members";
|
||||
has_workspace_key: boolean;
|
||||
};
|
||||
|
||||
export type TInstanceWorkspaceFeaturesResponse = {
|
||||
features: TInstanceWorkspaceFeature[];
|
||||
};
|
||||
|
||||
export interface IWorkspaceMemberMe {
|
||||
company_role: string | null;
|
||||
created_at: Date;
|
||||
|
||||
Reference in New Issue
Block a user