Files
plane/web/ee/services/project/estimate.service.ts
Prateek Shourya 434e4c936c [WEB-2332] chore: add desktop app provider. (#1052)
* [WEB-2332] chore: add desktop app provider.

* chore: improve layout.

* chore: export `EstimateService` class.
2024-09-06 16:49:03 +05:30

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;