mirror of
https://github.com/makeplane/plane.git
synced 2026-07-12 21:40:18 +02:00
* [WEB-2332] chore: add desktop app provider. * chore: improve layout. * chore: export `EstimateService` class.
51 lines
1.3 KiB
TypeScript
51 lines
1.3 KiB
TypeScript
/* eslint-disable no-useless-catch */
|
|
|
|
// types
|
|
import { IEstimate, IEstimateFormData, IEstimatePoint } from "@plane/types";
|
|
// ce services
|
|
import { EstimateService as CeEstimateService } from "@/ce/services/project/estimate.service";
|
|
|
|
export class EstimateService extends CeEstimateService {
|
|
constructor() {
|
|
super();
|
|
}
|
|
|
|
async updateEstimate(
|
|
workspaceSlug: string,
|
|
projectId: string,
|
|
estimateId: string,
|
|
payload: Partial<IEstimateFormData>
|
|
): Promise<IEstimate | undefined> {
|
|
try {
|
|
const { data } = await this.patch(
|
|
`/api/workspaces/${workspaceSlug}/projects/${projectId}/estimates/${estimateId}/`,
|
|
payload
|
|
);
|
|
return data || undefined;
|
|
} catch (error) {
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
async removeEstimatePoint(
|
|
workspaceSlug: string,
|
|
projectId: string,
|
|
estimateId: string,
|
|
estimatePointId: string,
|
|
params?: { new_estimate_id: string | undefined }
|
|
): Promise<IEstimatePoint[] | undefined> {
|
|
return this.delete(
|
|
`/api/workspaces/${workspaceSlug}/projects/${projectId}/estimates/${estimateId}/estimate-points/${estimatePointId}/`,
|
|
params
|
|
)
|
|
.then((response) => response?.data)
|
|
.catch((error) => {
|
|
throw error?.response?.data;
|
|
});
|
|
}
|
|
}
|
|
|
|
const estimateService = new EstimateService();
|
|
|
|
export default estimateService;
|