chore: cycle type and services updated

This commit is contained in:
Anmol Singh Bhatia 2023-02-28 14:47:32 +05:30
parent d480325829
commit 443c9300dd
2 changed files with 16 additions and 4 deletions

View File

@ -1,7 +1,7 @@
// services // services
import APIService from "services/api.service"; import APIService from "services/api.service";
// types // types
import type { ICycle } from "types"; import type { CompletedCyclesResponse, CurrentAndUpcomingCyclesResponse, ICycle } from "types";
const { NEXT_PUBLIC_API_BASE_URL } = process.env; const { NEXT_PUBLIC_API_BASE_URL } = process.env;
@ -99,7 +99,7 @@ class ProjectCycleServices extends APIService {
}); });
} }
async getCurrentAndUpcomingCycles(workspaceSlug: string, projectId: string): Promise<any> { async getCurrentAndUpcomingCycles(workspaceSlug: string, projectId: string): Promise<CurrentAndUpcomingCyclesResponse> {
return this.get( return this.get(
`/api/workspaces/${workspaceSlug}/projects/${projectId}/cycles/current-upcoming-cycles/` `/api/workspaces/${workspaceSlug}/projects/${projectId}/cycles/current-upcoming-cycles/`
) )
@ -109,9 +109,9 @@ class ProjectCycleServices extends APIService {
}); });
} }
async getCompletedCycles(workspaceSlug: string, projectId: string): Promise<any> { async getCompletedCycles(workspaceSlug: string, projectId: string): Promise<CompletedCyclesResponse> {
return this.get( return this.get(
`/api/workspaces/${workspaceSlug}/projects/${projectId}/cycles/past-cycles/` `/api/workspaces/${workspaceSlug}/projects/${projectId}/cycles/completed-cycles/`
) )
.then((response) => response?.data) .then((response) => response?.data)
.catch((error) => { .catch((error) => {

View File

@ -15,8 +15,20 @@ export interface ICycle {
project: string; project: string;
workspace: string; workspace: string;
issue: string; issue: string;
current_cycle: [];
upcoming_cycle: [];
past_cycles: [];
} }
export interface CurrentAndUpcomingCyclesResponse {
current_cycle : ICycle[];
upcoming_cycle : ICycle[];
}
export interface CompletedCyclesResponse {
completed_cycles : ICycle[];
}
export interface CycleIssueResponse { export interface CycleIssueResponse {
id: string; id: string;
issue_detail: IIssue; issue_detail: IIssue;