mirror of
https://github.com/makeplane/plane
synced 2024-06-14 14:31:34 +00:00
chore: draft cycle services and types
This commit is contained in:
parent
a840cea9e9
commit
7ab6eb7b48
@ -1,5 +0,0 @@
|
||||
export const CYCLE_STATUS = [
|
||||
{ label: "Started", value: "started", color: "#5e6ad2" },
|
||||
{ label: "Completed", value: "completed", color: "#eb5757" },
|
||||
{ label: "Draft", value: "draft", color: "#f2c94c" },
|
||||
];
|
@ -36,6 +36,7 @@ export const CYCLE_LIST = (projectId: string) => `CYCLE_LIST_${projectId}`;
|
||||
export const CYCLE_ISSUES = (cycleId: string) => `CYCLE_ISSUES_${cycleId}`;
|
||||
export const CYCLE_DETAILS = (cycleId: string) => `CYCLE_DETAIL_${cycleId}`;
|
||||
export const CYCLE_CURRENT_AND_UPCOMING_LIST = (projectId: string) => `CYCLE_CURRENT_AND_UPCOMING_LIST_${projectId}`;
|
||||
export const CYCLE_DRAFT_LIST = (projectId: string) => `CYCLE_DRAFT_LIST_${projectId}`;
|
||||
export const CYCLE_COMPLETE_LIST = (projectId: string) => `CYCLE_COMPLETE_LIST_${projectId}`;
|
||||
|
||||
export const STATE_LIST = (projectId: string) => `STATE_LIST_${projectId}`;
|
||||
|
@ -1,7 +1,7 @@
|
||||
// services
|
||||
import APIService from "services/api.service";
|
||||
// types
|
||||
import type { CompletedCyclesResponse, CurrentAndUpcomingCyclesResponse, ICycle } from "types";
|
||||
import type { CompletedCyclesResponse, CurrentAndUpcomingCyclesResponse, DraftCyclesResponse, ICycle } from "types";
|
||||
|
||||
const { NEXT_PUBLIC_API_BASE_URL } = process.env;
|
||||
|
||||
@ -109,6 +109,16 @@ class ProjectCycleServices extends APIService {
|
||||
});
|
||||
}
|
||||
|
||||
async getDraftCycles(workspaceSlug: string, projectId: string): Promise<DraftCyclesResponse> {
|
||||
return this.get(
|
||||
`/api/workspaces/${workspaceSlug}/projects/${projectId}/cycles/draft-cycles/`
|
||||
)
|
||||
.then((response) => response?.data)
|
||||
.catch((error) => {
|
||||
throw error?.response?.data;
|
||||
});
|
||||
}
|
||||
|
||||
async getCompletedCycles(workspaceSlug: string, projectId: string): Promise<CompletedCyclesResponse> {
|
||||
return this.get(
|
||||
`/api/workspaces/${workspaceSlug}/projects/${projectId}/cycles/completed-cycles/`
|
||||
|
10
apps/app/types/cycles.d.ts
vendored
10
apps/app/types/cycles.d.ts
vendored
@ -7,9 +7,8 @@ export interface ICycle {
|
||||
updated_at: Date;
|
||||
name: string;
|
||||
description: string;
|
||||
start_date: string;
|
||||
end_date: string;
|
||||
status: string;
|
||||
start_date: string | null;
|
||||
end_date: string | null;
|
||||
created_by: string;
|
||||
updated_by: string;
|
||||
project: string;
|
||||
@ -25,6 +24,11 @@ export interface CurrentAndUpcomingCyclesResponse {
|
||||
upcoming_cycle : ICycle[];
|
||||
}
|
||||
|
||||
|
||||
export interface DraftCyclesResponse {
|
||||
draft_cycles : ICycle[];
|
||||
}
|
||||
|
||||
export interface CompletedCyclesResponse {
|
||||
completed_cycles : ICycle[];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user