2024-07-05 14:51:59 +05:30
|
|
|
// constants
|
2024-06-28 18:37:38 +05:30
|
|
|
import { EViewAccess } from "@/constants/views";
|
2024-07-05 14:51:59 +05:30
|
|
|
// helpers
|
2024-06-28 18:37:38 +05:30
|
|
|
import { API_BASE_URL } from "@/helpers/common.helper";
|
2024-07-05 14:51:59 +05:30
|
|
|
// types
|
|
|
|
|
import { TWorkspaceWithProductDetails } from "@/plane-web/types";
|
|
|
|
|
// services
|
2024-06-28 18:37:38 +05:30
|
|
|
import { WorkspaceService as CoreWorkspaceService } from "@/services/workspace.service";
|
|
|
|
|
|
|
|
|
|
export class WorkspaceService extends CoreWorkspaceService {
|
|
|
|
|
constructor() {
|
|
|
|
|
super(API_BASE_URL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async updateViewAccess(workspaceSlug: string, viewId: string, access: EViewAccess) {
|
|
|
|
|
return this.post(`/api/workspaces/${workspaceSlug}/views/${viewId}/access/`, {
|
|
|
|
|
access,
|
|
|
|
|
}).catch((error) => {
|
|
|
|
|
throw error?.response?.data;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async lockView(workspaceSlug: string, viewId: string) {
|
|
|
|
|
return this.post(`/api/workspaces/${workspaceSlug}/views/${viewId}/lock/`).catch((error) => {
|
|
|
|
|
throw error?.response?.data;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
async unLockView(workspaceSlug: string, viewId: string) {
|
|
|
|
|
return this.delete(`/api/workspaces/${workspaceSlug}/views/${viewId}/lock/`).catch((error) => {
|
|
|
|
|
throw error?.response?.data;
|
|
|
|
|
});
|
|
|
|
|
}
|
2024-07-05 14:51:59 +05:30
|
|
|
|
|
|
|
|
async getWorkspacesWithPlanDetails(): Promise<TWorkspaceWithProductDetails[]> {
|
|
|
|
|
return this.get(`/api/payments/website/workspaces/`)
|
|
|
|
|
.then((response) => response?.data)
|
|
|
|
|
.catch((error) => {
|
|
|
|
|
throw error?.response;
|
|
|
|
|
});
|
|
|
|
|
}
|
2024-11-05 19:39:28 +05:30
|
|
|
|
|
|
|
|
async searchAcrossWorkspace(workspaceSlug: string, params: { search: string; projectId?: string }) {
|
|
|
|
|
return this.get(`/api/workspaces/${workspaceSlug}/search/`, {
|
|
|
|
|
params,
|
|
|
|
|
}).then((response) => response?.data);
|
|
|
|
|
}
|
2024-06-28 18:37:38 +05:30
|
|
|
}
|