Skip to content
Snippets Groups Projects
Commit 216b609c authored by Bernard Roland (Student Com20)'s avatar Bernard Roland (Student Com20)
Browse files

Added adapters for team statistics

parent f85d5eb0
No related branches found
No related tags found
No related merge requests found
......@@ -19,6 +19,18 @@ export interface TeamMember extends User {
role: TeamRole;
}
export interface TeamActivity {
day: string;
time: number;
}
export interface TeamCompletion {
open: number,
closed: number,
suspended: number,
overdue: number,
}
export function getTeams(): Promise<Team[]> {
return executeApiGet(`team`, ({ teams }) => teams, "Failed to get teams");
}
......@@ -50,6 +62,20 @@ export function getTeamWork(uuid: string): Promise<Work[]> {
})), "Failed to get team work");
}
export function getTeamActivity(uuid: string, from: Date = new Date(0), to: Date = new Date()): Promise<TeamActivity[]> {
return executeApiGet(
`team/${uuid}/activity?since=${from.getTime()}&to=${to.getTime()}`,
({ activity }) => activity, "Failed to get team activity"
);
}
export function getTeamCompletion(uuid: string, from: Date = new Date(0), to: Date = new Date()): Promise<TeamCompletion> {
return executeApiGet(
`team/${uuid}/completion?since=${from.getTime()}&to=${to.getTime()}`,
({ completion }) => completion, "Failed to get team completion"
);
}
export function createTeam(name: string): Promise<string> {
return executeApiPost(`team`, { name: name }, ({ id }) => id, "Failed to create team");
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment