Files
plane/web/ee/services/cycle.service.ts

94 lines
2.6 KiB
TypeScript
Raw Permalink Normal View History

[WEB-2380] Chore: Cycle graphs updated (#1198) * chore: graph based on dummy data * fix: progress donut * feat: created new cycle analytics * wip: dropdowns * chore: migration changes * chore: changed the calculation of cycle analytics * fix: integrational changes * fix: reference line for today * fix: code cleaning * fix: added loaders * fix: type removed * chore: sidebar width and spacing improvement * chore: sidebar improvement * fix: handled empty state * chore: cycle sidebar graph * chore: live update on cycle analytics * chore: removed the unused variable * fix: chart minor issues * chore: cycle sidebar graph improvement * fix: chart minor bugs * fix: code-splitting for active cycles * fix: routing with dynamic import * fix: peekoverview * fix: responsiveness * fix: handled run time updates in cycle chart * fix: feature flagging for sidebar * fix: added scope delta + fixed sidebar dropdown * fix: sidebar chart * fix: build errors * fix: cycle store ee added * fix: cycle chart update api * fix: removed custom date time functions * fix: ideal line formula updated * fix: feature flagging condition * fix: build errors * fix: chart label * chore: moved the migraion to ee * chore: removed the unused variable * fix: sentry error sample rate updated * fix: cycles import issues for ee (#5732) (#1312) Co-authored-by: Akshita Goyal <36129505+gakshita@users.noreply.github.com> Co-authored-by: Satish Gandham <satish.iitg@gmail.com> * fix: cycle api formatting for v1 data * chore: bulk estimate changes * chore: update reaction changes * chore: cycle sidebar improvement * fix: cycle graph build bugs (#1327) * fix: build error * chore: import order and unused variable refactor * chore: update reaction changes * fix: data formatting for v1 and v2 * fix: lint errors * [WEB-2108] chore: 12 users restriction for cloud users. (#1330) * [WEB-2108] chore: 12 users restriction for cloud users. * chore: update total_seats count. * fix:props for active cycle root component * fix: removed dependency from root package.json * fix: chart minor fixes * fix: minor code fixes * chore: comments listing * fix: handled no data state * fix: removed hardcoded version * fix: order fixed * fix: added comments * chore: code splitting and refactoring * chore: removed the unqiue constraint * fix: minor css issues + swr fixed + chart data * fix: ideal formula fixed * fix: added version while creating a cycle --------- Co-authored-by: NarayanBavisetti <narayan3119@gmail.com> Co-authored-by: Anmol Singh Bhatia <anmolsinghbhatia@plane.so> Co-authored-by: sriram veeraghanta <veeraghanta.sriram@gmail.com> Co-authored-by: pushya22 <130810100+pushya22@users.noreply.github.com> Co-authored-by: Plane Bot <146718762+plane-bot@users.noreply.github.com> Co-authored-by: Satish Gandham <satish.iitg@gmail.com> Co-authored-by: Pushya Mitra Thiruvooru <pushya@Pushyas-MacBook-Pro.local> Co-authored-by: Prateek Shourya <prateekshourya29@gmail.com>
2024-10-08 20:03:42 +05:30
// helpers
import { API_BASE_URL } from "@/helpers/common.helper";
// services
import { APIService } from "@/services/api.service";
import { TCycleUpdateReaction, TCycleUpdates, TCycleUpdateStatus } from "../types";
export class CycleUpdateService extends APIService {
constructor() {
super(API_BASE_URL);
}
// EE Services
async getCycleUpdates(workspaceSlug: string, projectId: string, cycleId: string): Promise<TCycleUpdates[]> {
return this.get(`/api/workspaces/${workspaceSlug}/projects/${projectId}/cycles/${cycleId}/updates/`)
.then((res) => res?.data)
.catch((err) => {
throw err?.response?.data;
});
}
async createCycleUpdate(
workspaceSlug: string,
projectId: string,
cycleId: string,
data: Partial<TCycleUpdates>
): Promise<TCycleUpdates> {
return this.post(`/api/workspaces/${workspaceSlug}/projects/${projectId}/cycles/${cycleId}/updates/`, data)
.then((res) => res?.data)
.catch((err) => {
throw err?.response?.data;
});
}
async updateCycleUpdate(
workspaceSlug: string,
projectId: string,
cycleId: string,
updateId: string,
data: Partial<TCycleUpdates>
): Promise<any> {
return this.patch(
`/api/workspaces/${workspaceSlug}/projects/${projectId}/cycles/${cycleId}/updates/${updateId}/`,
data
)
.then((res) => res?.data)
.catch((err) => {
throw err?.response?.data;
});
}
async deleteCycleUpdate(workspaceSlug: string, projectId: string, cycleId: string, updateId: string): Promise<any> {
return this.delete(`/api/workspaces/${workspaceSlug}/projects/${projectId}/cycles/${cycleId}/updates/${updateId}/`)
.then((res) => res?.data)
.catch((err) => {
throw err?.response?.data;
});
}
// reactions
async createCycleUpdateReaction(
workspaceSlug: string,
projectId: string,
cycleId: string,
updateId: string,
data: TCycleUpdateReaction
): Promise<any> {
return this.post(
`/api/workspaces/${workspaceSlug}/projects/${projectId}/cycles/${cycleId}/updates/${updateId}/reactions`,
data
)
.then((res) => res?.data)
.catch((err) => {
throw err?.response?.data;
});
}
async deleteCycleUpdateReaction(
workspaceSlug: string,
projectId: string,
cycleId: string,
updateId: string,
reactionId: string
): Promise<any> {
return this.delete(
`/api/workspaces/${workspaceSlug}/projects/${projectId}/cycles/${cycleId}/updates/${updateId}/reactions/${reactionId}`
)
.then((res) => res?.data)
.catch((err) => {
throw err?.response?.data;
});
}
}