mirror of
https://github.com/makeplane/plane.git
synced 2026-07-12 21:40:18 +02:00
* chore: views publish endpoints * fix: members and cycles endpoint * chore: added issue count and attachment count * chore: resolved build errors * chore: added created at and updated at in issue response * chore: comments, votes and reaction endpoints * chore: removed the comment, votes and reaction endpoint * feat Publish views * chore: added import statement * revert back unnecessary non ee changes * fix gantt layout * fix view issues * fix lints and remove unncessary code * revert back yarn.lock --------- Co-authored-by: NarayanBavisetti <narayan3119@gmail.com>
81 lines
2.6 KiB
TypeScript
81 lines
2.6 KiB
TypeScript
import { TPublishViewSettings } from "@plane/types";
|
|
import { EViewAccess } from "@/constants/views";
|
|
import { API_BASE_URL } from "@/helpers/common.helper";
|
|
import { ViewService as CoreViewService } from "@/services/view.service";
|
|
|
|
export class ViewService extends CoreViewService {
|
|
constructor() {
|
|
super(API_BASE_URL);
|
|
}
|
|
|
|
async updateViewAccess(workspaceSlug: string, projectId: string, viewId: string, access: EViewAccess) {
|
|
return await this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/views/${viewId}/access/`, {
|
|
access,
|
|
}).catch((error) => {
|
|
throw error?.response?.data;
|
|
});
|
|
}
|
|
|
|
async lockView(workspaceSlug: string, projectId: string, viewId: string) {
|
|
return await this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/views/${viewId}/lock/`).catch(
|
|
(error) => {
|
|
throw error?.response?.data;
|
|
}
|
|
);
|
|
}
|
|
|
|
async unLockView(workspaceSlug: string, projectId: string, viewId: string) {
|
|
return await this.delete(`/api/workspaces/${workspaceSlug}/projects/${projectId}/views/${viewId}/lock/`).catch(
|
|
(error) => {
|
|
throw error?.response?.data;
|
|
}
|
|
);
|
|
}
|
|
|
|
async getPublishDetails(workspaceSlug: string, projectId: string, viewId: string) {
|
|
return await this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/views/${viewId}/publish/`)
|
|
.then((response) => response?.data)
|
|
.catch((error) => {
|
|
throw error?.response?.data;
|
|
});
|
|
}
|
|
|
|
async publishView(workspaceSlug: string, projectId: string, viewId: string, data: TPublishViewSettings) {
|
|
return await this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/views/${viewId}/publish/`, {
|
|
...data,
|
|
view_props: {
|
|
list: true,
|
|
kanban: true,
|
|
calendar: true,
|
|
gantt: true,
|
|
spreadsheet: true,
|
|
},
|
|
})
|
|
.then((response) => response?.data)
|
|
.catch((error) => {
|
|
throw error?.response?.data;
|
|
});
|
|
}
|
|
|
|
async updatePublishedView(
|
|
workspaceSlug: string,
|
|
projectId: string,
|
|
viewId: string,
|
|
data: Partial<TPublishViewSettings>
|
|
) {
|
|
return await this.patch(`/api/workspaces/${workspaceSlug}/projects/${projectId}/views/${viewId}/publish/`, data)
|
|
.then((response) => response?.data)
|
|
.catch((error) => {
|
|
throw error?.response?.data;
|
|
});
|
|
}
|
|
|
|
async unPublishView(workspaceSlug: string, projectId: string, viewId: string) {
|
|
return await this.delete(`/api/workspaces/${workspaceSlug}/projects/${projectId}/views/${viewId}/publish/`)
|
|
.then((response) => response?.data)
|
|
.catch((error) => {
|
|
throw error?.response?.data;
|
|
});
|
|
}
|
|
}
|