// 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 { 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 ): Promise { 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 ): Promise { 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 { 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 { 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 { return this.delete( `/api/workspaces/${workspaceSlug}/projects/${projectId}/cycles/${cycleId}/updates/${updateId}/reactions/${reactionId}` ) .then((res) => res?.data) .catch((err) => { throw err?.response?.data; }); } }