feat: init
This commit is contained in:
2
apps/web/ce/services/index.ts
Normal file
2
apps/web/ce/services/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from "./project";
|
||||
export * from "@/services/workspace.service";
|
||||
106
apps/web/ce/services/project/estimate.service.ts
Normal file
106
apps/web/ce/services/project/estimate.service.ts
Normal file
@@ -0,0 +1,106 @@
|
||||
/* eslint-disable no-useless-catch */
|
||||
|
||||
// types
|
||||
import { API_BASE_URL } from "@plane/constants";
|
||||
import type { IEstimate, IEstimateFormData, IEstimatePoint } from "@plane/types";
|
||||
// helpers
|
||||
// services
|
||||
import { APIService } from "@/services/api.service";
|
||||
|
||||
export class EstimateService extends APIService {
|
||||
constructor() {
|
||||
super(API_BASE_URL);
|
||||
}
|
||||
|
||||
async fetchWorkspaceEstimates(workspaceSlug: string): Promise<IEstimate[] | undefined> {
|
||||
try {
|
||||
const { data } = await this.get(`/api/workspaces/${workspaceSlug}/estimates/`);
|
||||
return data || undefined;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
async fetchProjectEstimates(workspaceSlug: string, projectId: string): Promise<IEstimate[] | undefined> {
|
||||
try {
|
||||
const { data } = await this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/estimates/`);
|
||||
return data || undefined;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
async fetchEstimateById(
|
||||
workspaceSlug: string,
|
||||
projectId: string,
|
||||
estimateId: string
|
||||
): Promise<IEstimate | undefined> {
|
||||
try {
|
||||
const { data } = await this.get(
|
||||
`/api/workspaces/${workspaceSlug}/projects/${projectId}/estimates/${estimateId}/`
|
||||
);
|
||||
return data || undefined;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
async createEstimate(
|
||||
workspaceSlug: string,
|
||||
projectId: string,
|
||||
payload: IEstimateFormData
|
||||
): Promise<IEstimate | undefined> {
|
||||
try {
|
||||
const { data } = await this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/estimates/`, payload);
|
||||
return data || undefined;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
async deleteEstimate(workspaceSlug: string, projectId: string, estimateId: string): Promise<void> {
|
||||
try {
|
||||
await this.delete(`/api/workspaces/${workspaceSlug}/projects/${projectId}/estimates/${estimateId}/`);
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
async createEstimatePoint(
|
||||
workspaceSlug: string,
|
||||
projectId: string,
|
||||
estimateId: string,
|
||||
payload: Partial<IEstimatePoint>
|
||||
): Promise<IEstimatePoint | undefined> {
|
||||
try {
|
||||
const { data } = await this.post(
|
||||
`/api/workspaces/${workspaceSlug}/projects/${projectId}/estimates/${estimateId}/estimate-points/`,
|
||||
payload
|
||||
);
|
||||
return data || undefined;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
async updateEstimatePoint(
|
||||
workspaceSlug: string,
|
||||
projectId: string,
|
||||
estimateId: string,
|
||||
estimatePointId: string,
|
||||
payload: Partial<IEstimatePoint>
|
||||
): Promise<IEstimatePoint | undefined> {
|
||||
try {
|
||||
const { data } = await this.patch(
|
||||
`/api/workspaces/${workspaceSlug}/projects/${projectId}/estimates/${estimateId}/estimate-points/${estimatePointId}/`,
|
||||
payload
|
||||
);
|
||||
return data || undefined;
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
const estimateService = new EstimateService();
|
||||
|
||||
export default estimateService;
|
||||
2
apps/web/ce/services/project/index.ts
Normal file
2
apps/web/ce/services/project/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from "./estimate.service";
|
||||
export * from "@/services/view.service";
|
||||
1
apps/web/ce/services/project/project-state.service.ts
Normal file
1
apps/web/ce/services/project/project-state.service.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from "@/services/project/project-state.service";
|
||||
Reference in New Issue
Block a user