mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
b3ac9def8d
* dev: workspace states and estimates * refactor issue dropdown logic to help work properly with issues on global level * fix: project labels response change * fix label type * change store computed actions to computed functions from mobx-utils * fix: state response change * chore: project and workspace state change * fix state and label types * chore: state and label serializer change * modify state and label types * fix dropdown reset on project id change * fix label sort order --------- Co-authored-by: pablohashescobar <nikhilschacko@gmail.com> Co-authored-by: Rahul R <rahulr@Rahuls-MacBook-Pro.local> Co-authored-by: NarayanBavisetti <narayan3119@gmail.com> Co-authored-by: Rahul R <rahul.ramesha@plane.so>
73 lines
2.3 KiB
TypeScript
73 lines
2.3 KiB
TypeScript
// services
|
|
import { APIService } from "services/api.service";
|
|
// types
|
|
import type { IEstimate, IEstimateFormData, IEstimatePoint } from "@plane/types";
|
|
// helpers
|
|
import { API_BASE_URL } from "helpers/common.helper";
|
|
|
|
export class ProjectEstimateService extends APIService {
|
|
constructor() {
|
|
super(API_BASE_URL);
|
|
}
|
|
|
|
async createEstimate(
|
|
workspaceSlug: string,
|
|
projectId: string,
|
|
data: IEstimateFormData
|
|
): Promise<{
|
|
estimate: IEstimate;
|
|
estimate_points: IEstimatePoint[];
|
|
}> {
|
|
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/estimates/`, data)
|
|
.then((response) => response?.data)
|
|
.catch((error) => {
|
|
throw error?.response;
|
|
});
|
|
}
|
|
|
|
async patchEstimate(
|
|
workspaceSlug: string,
|
|
projectId: string,
|
|
estimateId: string,
|
|
data: IEstimateFormData
|
|
): Promise<any> {
|
|
return this.patch(`/api/workspaces/${workspaceSlug}/projects/${projectId}/estimates/${estimateId}/`, data)
|
|
.then((response) => response?.data)
|
|
.catch((error) => {
|
|
throw error?.response?.data;
|
|
});
|
|
}
|
|
|
|
async getEstimateDetails(workspaceSlug: string, projectId: string, estimateId: string): Promise<IEstimate> {
|
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/estimates/${estimateId}/`)
|
|
.then((response) => response?.data)
|
|
.catch((error) => {
|
|
throw error?.response?.data;
|
|
});
|
|
}
|
|
|
|
async getEstimatesList(workspaceSlug: string, projectId: string): Promise<IEstimate[]> {
|
|
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/estimates/`)
|
|
.then((response) => response?.data)
|
|
.catch((error) => {
|
|
throw error?.response?.data;
|
|
});
|
|
}
|
|
|
|
async deleteEstimate(workspaceSlug: string, projectId: string, estimateId: string): Promise<any> {
|
|
return this.delete(`/api/workspaces/${workspaceSlug}/projects/${projectId}/estimates/${estimateId}/`)
|
|
.then((response) => response?.data)
|
|
.catch((error) => {
|
|
throw error?.response?.data;
|
|
});
|
|
}
|
|
|
|
async getWorkspaceEstimatesList(workspaceSlug: string): Promise<IEstimate[]> {
|
|
return this.get(`/api/workspaces/${workspaceSlug}/estimates/`)
|
|
.then((response) => response?.data)
|
|
.catch((error) => {
|
|
throw error?.response?.data;
|
|
});
|
|
}
|
|
}
|