added chart.js
This commit is contained in:
@@ -1,265 +1,281 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import {HttpClient, HttpResponse} from '@angular/common/http';
|
||||
import {Observable} from 'rxjs';
|
||||
import {environment} from '../../environments/environment';
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { HttpClient, HttpResponse } from '@angular/common/http';
|
||||
import { Observable } from 'rxjs';
|
||||
import { environment } from '../../environments/environment';
|
||||
|
||||
@Injectable()
|
||||
export class BackendService {
|
||||
constructor(private httpClient: HttpClient) {}
|
||||
|
||||
constructor(private httpClient: HttpClient) {}
|
||||
// Tasks
|
||||
public getTasks(): Observable<HttpResponse<ScrumTask[]>> {
|
||||
const url = `${environment.apiUrl}/tasks`;
|
||||
return this.httpClient.get<ScrumTask[]>(url, { observe: 'response' });
|
||||
}
|
||||
|
||||
public getTask(id: number): Observable<HttpResponse<ScrumTask>> {
|
||||
const url = `${environment.apiUrl}/tasks/${id}`;
|
||||
return this.httpClient.get<ScrumTask>(url, { observe: 'response' });
|
||||
}
|
||||
|
||||
// Tasks
|
||||
public getTasks(): Observable<HttpResponse<ScrumTask[]>> {
|
||||
const url = `${environment.apiUrl}/tasks`;
|
||||
return this.httpClient.get<ScrumTask[]>(url, { observe: 'response' });
|
||||
}
|
||||
public postTask(task: ScrumTask): Observable<HttpResponse<ScrumTask>> {
|
||||
const url = `${environment.apiUrl}/tasks`;
|
||||
return this.httpClient.post<ScrumTask>(url, task, { observe: 'response' });
|
||||
}
|
||||
|
||||
public getTask(id: number): Observable<HttpResponse<ScrumTask>> {
|
||||
const url = `${environment.apiUrl}/tasks/${id}`;
|
||||
return this.httpClient.get<ScrumTask>(url, { observe: 'response' });
|
||||
}
|
||||
public putTask(task: ScrumTask): Observable<HttpResponse<any>> {
|
||||
const url = `${environment.apiUrl}/tasks/${task.id}`;
|
||||
return this.httpClient.put(url, task, { observe: 'response' });
|
||||
}
|
||||
|
||||
public postTask(task: ScrumTask): Observable<HttpResponse<ScrumTask>> {
|
||||
const url = `${environment.apiUrl}/tasks`;
|
||||
return this.httpClient.post<ScrumTask>(url, task, { observe: 'response' });
|
||||
}
|
||||
public deleteTask(task: ScrumTask): Observable<HttpResponse<any>> {
|
||||
const url = `${environment.apiUrl}/tasks/${task.id}`;
|
||||
return this.httpClient.delete(url, { observe: 'response' });
|
||||
}
|
||||
|
||||
public putTask(task: ScrumTask): Observable<HttpResponse<any>> {
|
||||
const url = `${environment.apiUrl}/tasks/${task.id}`;
|
||||
return this.httpClient.put(url, task, { observe: 'response' });
|
||||
}
|
||||
// Userstories
|
||||
public getUserstories(): Observable<HttpResponse<ScrumUserstory[]>> {
|
||||
const url = `${environment.apiUrl}/userstories`;
|
||||
return this.httpClient.get<ScrumUserstory[]>(url, { observe: 'response' });
|
||||
}
|
||||
|
||||
public deleteTask(task: ScrumTask): Observable<HttpResponse<any>> {
|
||||
const url = `${environment.apiUrl}/tasks/${task.id}`;
|
||||
return this.httpClient.delete(url, {observe: 'response'});
|
||||
}
|
||||
public getUserstory(id: number): Observable<HttpResponse<ScrumUserstory>> {
|
||||
const url = `${environment.apiUrl}/userstories/${id}`;
|
||||
return this.httpClient.get<ScrumUserstory>(url, { observe: 'response' });
|
||||
}
|
||||
|
||||
public postUserstory(
|
||||
userstory: ScrumUserstory
|
||||
): Observable<HttpResponse<ScrumUserstory>> {
|
||||
const url = `${environment.apiUrl}/userstories`;
|
||||
return this.httpClient.post<ScrumUserstory>(url, userstory, {
|
||||
observe: 'response',
|
||||
});
|
||||
}
|
||||
|
||||
// Userstories
|
||||
public getUserstories(): Observable<HttpResponse<ScrumUserstory[]>> {
|
||||
const url = `${environment.apiUrl}/userstories`;
|
||||
return this.httpClient.get<ScrumUserstory[]>(url, { observe: 'response' });
|
||||
}
|
||||
public putUserstory(
|
||||
userstory: ScrumUserstory
|
||||
): Observable<HttpResponse<any>> {
|
||||
const url = `${environment.apiUrl}/userstories/${userstory.id}`;
|
||||
return this.httpClient.put(url, userstory, { observe: 'response' });
|
||||
}
|
||||
|
||||
public getUserstory(id: number): Observable<HttpResponse<ScrumUserstory>> {
|
||||
const url = `${environment.apiUrl}/userstories/${id}`;
|
||||
return this.httpClient.get<ScrumUserstory>(url, { observe: 'response' });
|
||||
}
|
||||
public deleteUserstory(
|
||||
userstory: ScrumUserstory
|
||||
): Observable<HttpResponse<any>> {
|
||||
const url = `${environment.apiUrl}/userstories/${userstory.id}`;
|
||||
return this.httpClient.delete(url, { observe: 'response' });
|
||||
}
|
||||
|
||||
public postUserstory(userstory: ScrumUserstory): Observable<HttpResponse<ScrumUserstory>> {
|
||||
const url = `${environment.apiUrl}/userstories`;
|
||||
return this.httpClient.post<ScrumUserstory>(url, userstory, { observe: 'response' });
|
||||
}
|
||||
// Sprints
|
||||
public getSprints(): Observable<HttpResponse<ScrumSprint[]>> {
|
||||
const url = `${environment.apiUrl}/sprints`;
|
||||
return this.httpClient.get<ScrumSprint[]>(url, { observe: 'response' });
|
||||
}
|
||||
|
||||
public putUserstory(userstory: ScrumUserstory): Observable<HttpResponse<any>> {
|
||||
const url = `${environment.apiUrl}/userstories/${userstory.id}`;
|
||||
return this.httpClient.put(url, userstory, { observe: 'response' });
|
||||
}
|
||||
public getSprint(id: number): Observable<HttpResponse<ScrumSprint>> {
|
||||
const url = `${environment.apiUrl}/sprints/${id}`;
|
||||
return this.httpClient.get<ScrumSprint>(url, { observe: 'response' });
|
||||
}
|
||||
|
||||
public deleteUserstory(userstory: ScrumUserstory): Observable<HttpResponse<any>> {
|
||||
const url = `${environment.apiUrl}/userstories/${userstory.id}`;
|
||||
return this.httpClient.delete(url, {observe: 'response'});
|
||||
}
|
||||
public postSprint(
|
||||
sprint: ScrumSprint
|
||||
): Observable<HttpResponse<ScrumSprint>> {
|
||||
const url = `${environment.apiUrl}/sprints`;
|
||||
return this.httpClient.post<ScrumSprint>(url, sprint, {
|
||||
observe: 'response',
|
||||
});
|
||||
}
|
||||
|
||||
public putSprint(sprint: ScrumSprint): Observable<HttpResponse<any>> {
|
||||
const url = `${environment.apiUrl}/sprints/${sprint.id}`;
|
||||
return this.httpClient.put(url, sprint, { observe: 'response' });
|
||||
}
|
||||
|
||||
// Sprints
|
||||
public getSprints(): Observable<HttpResponse<ScrumSprint[]>> {
|
||||
const url = `${environment.apiUrl}/sprints`;
|
||||
return this.httpClient.get<ScrumSprint[]>(url, { observe: 'response' });
|
||||
}
|
||||
public deleteSprint(sprint: ScrumSprint): Observable<HttpResponse<any>> {
|
||||
const url = `${environment.apiUrl}/sprints/${sprint.id}`;
|
||||
return this.httpClient.delete(url, { observe: 'response' });
|
||||
}
|
||||
|
||||
public getSprint(id: number): Observable<HttpResponse<ScrumSprint>> {
|
||||
const url = `${environment.apiUrl}/sprints/${id}`;
|
||||
return this.httpClient.get<ScrumSprint>(url, { observe: 'response' });
|
||||
}
|
||||
// Categories
|
||||
public getCategories(): Observable<HttpResponse<ScrumCategory[]>> {
|
||||
const url = `${environment.apiUrl}/categories`;
|
||||
return this.httpClient.get<ScrumCategory[]>(url, { observe: 'response' });
|
||||
}
|
||||
|
||||
public postSprint(sprint: ScrumSprint): Observable<HttpResponse<ScrumSprint>> {
|
||||
const url = `${environment.apiUrl}/sprints`;
|
||||
return this.httpClient.post<ScrumSprint>(url, sprint, { observe: 'response' });
|
||||
}
|
||||
public getCategory(id: number): Observable<HttpResponse<ScrumCategory>> {
|
||||
const url = `${environment.apiUrl}/categories/${id}`;
|
||||
return this.httpClient.get<ScrumCategory>(url, { observe: 'response' });
|
||||
}
|
||||
|
||||
public putSprint(sprint: ScrumSprint): Observable<HttpResponse<any>> {
|
||||
const url = `${environment.apiUrl}/sprints/${sprint.id}`;
|
||||
return this.httpClient.put(url, sprint, { observe: 'response' });
|
||||
}
|
||||
public postCategory(
|
||||
category: ScrumCategory
|
||||
): Observable<HttpResponse<ScrumCategory>> {
|
||||
const url = `${environment.apiUrl}/categories`;
|
||||
return this.httpClient.post<ScrumCategory>(url, category, {
|
||||
observe: 'response',
|
||||
});
|
||||
}
|
||||
|
||||
public deleteSprint(sprint: ScrumSprint): Observable<HttpResponse<any>> {
|
||||
const url = `${environment.apiUrl}/sprints/${sprint.id}`;
|
||||
return this.httpClient.delete(url, {observe: 'response'});
|
||||
}
|
||||
public putCategory(category: ScrumCategory): Observable<HttpResponse<any>> {
|
||||
const url = `${environment.apiUrl}/categories/${category.id}`;
|
||||
return this.httpClient.put(url, category, { observe: 'response' });
|
||||
}
|
||||
|
||||
public deleteCategory(
|
||||
category: ScrumCategory
|
||||
): Observable<HttpResponse<any>> {
|
||||
const url = `${environment.apiUrl}/categories/${category.id}`;
|
||||
return this.httpClient.delete(url, { observe: 'response' });
|
||||
}
|
||||
|
||||
// Categories
|
||||
public getCategories(): Observable<HttpResponse<ScrumCategory[]>> {
|
||||
const url = `${environment.apiUrl}/categories`;
|
||||
return this.httpClient.get<ScrumCategory[]>(url, { observe: 'response' });
|
||||
}
|
||||
// Status
|
||||
public getAllStatus(): Observable<HttpResponse<ScrumStatus[]>> {
|
||||
const url = `${environment.apiUrl}/status`;
|
||||
return this.httpClient.get<ScrumStatus[]>(url, { observe: 'response' });
|
||||
}
|
||||
|
||||
public getCategory(id: number): Observable<HttpResponse<ScrumCategory>> {
|
||||
const url = `${environment.apiUrl}/categories/${id}`;
|
||||
return this.httpClient.get<ScrumCategory>(url, { observe: 'response' });
|
||||
}
|
||||
public getStatus(id: number): Observable<HttpResponse<ScrumStatus>> {
|
||||
const url = `${environment.apiUrl}/status/${id}`;
|
||||
return this.httpClient.get<ScrumStatus>(url, { observe: 'response' });
|
||||
}
|
||||
|
||||
public postCategory(category: ScrumCategory): Observable<HttpResponse<ScrumCategory>> {
|
||||
const url = `${environment.apiUrl}/categories`;
|
||||
return this.httpClient.post<ScrumCategory>(url, category, { observe: 'response' });
|
||||
}
|
||||
public postStatus(
|
||||
status: ScrumStatus
|
||||
): Observable<HttpResponse<ScrumStatus>> {
|
||||
const url = `${environment.apiUrl}/status`;
|
||||
return this.httpClient.post<ScrumStatus>(url, status, {
|
||||
observe: 'response',
|
||||
});
|
||||
}
|
||||
|
||||
public putCategory(category: ScrumCategory): Observable<HttpResponse<any>> {
|
||||
const url = `${environment.apiUrl}/categories/${category.id}`;
|
||||
return this.httpClient.put(url, category, { observe: 'response' });
|
||||
}
|
||||
public putStatus(status: ScrumStatus): Observable<HttpResponse<any>> {
|
||||
const url = `${environment.apiUrl}/status/${status.id}`;
|
||||
return this.httpClient.put(url, status, { observe: 'response' });
|
||||
}
|
||||
|
||||
public deleteCategory(category: ScrumCategory): Observable<HttpResponse<any>> {
|
||||
const url = `${environment.apiUrl}/categories/${category.id}`;
|
||||
return this.httpClient.delete(url, { observe: 'response' });
|
||||
}
|
||||
public deleteStatus(status: ScrumStatus): Observable<HttpResponse<any>> {
|
||||
const url = `${environment.apiUrl}/status/${status.id}`;
|
||||
return this.httpClient.delete(url, { observe: 'response' });
|
||||
}
|
||||
|
||||
// Users
|
||||
public getUsers(): Observable<HttpResponse<ScrumUser[]>> {
|
||||
const url = `${environment.apiUrl}/users`;
|
||||
return this.httpClient.get<ScrumUser[]>(url, { observe: 'response' });
|
||||
}
|
||||
|
||||
// Status
|
||||
public getAllStatus(): Observable<HttpResponse<ScrumStatus[]>> {
|
||||
const url = `${environment.apiUrl}/status`;
|
||||
return this.httpClient.get<ScrumStatus[]>(url, { observe: 'response' });
|
||||
}
|
||||
public getUser(id: number): Observable<HttpResponse<ScrumUser>> {
|
||||
const url = `${environment.apiUrl}/users/${id}`;
|
||||
return this.httpClient.get<ScrumUser>(url, { observe: 'response' });
|
||||
}
|
||||
|
||||
public getStatus(id: number): Observable<HttpResponse<ScrumStatus>> {
|
||||
const url = `${environment.apiUrl}/status/${id}`;
|
||||
return this.httpClient.get<ScrumStatus>(url, { observe: 'response' });
|
||||
}
|
||||
public postUser(user: ScrumUser): Observable<HttpResponse<ScrumUser>> {
|
||||
const url = `${environment.apiUrl}/users`;
|
||||
return this.httpClient.post<ScrumUser>(url, user, { observe: 'response' });
|
||||
}
|
||||
|
||||
public postStatus(status: ScrumStatus): Observable<HttpResponse<ScrumStatus>> {
|
||||
const url = `${environment.apiUrl}/status`;
|
||||
return this.httpClient.post<ScrumStatus>(url, status, { observe: 'response' });
|
||||
}
|
||||
public putUser(user: ScrumUser): Observable<HttpResponse<any>> {
|
||||
const url = `${environment.apiUrl}/users/${user.id}`;
|
||||
return this.httpClient.put(url, user, { observe: 'response' });
|
||||
}
|
||||
|
||||
public putStatus(status: ScrumStatus): Observable<HttpResponse<any>> {
|
||||
const url = `${environment.apiUrl}/status/${status.id}`;
|
||||
return this.httpClient.put(url, status, { observe: 'response' });
|
||||
}
|
||||
public deleteUser(user: ScrumUser): Observable<HttpResponse<any>> {
|
||||
const url = `${environment.apiUrl}/users/${user.id}`;
|
||||
return this.httpClient.delete(url, { observe: 'response' });
|
||||
}
|
||||
|
||||
public deleteStatus(status: ScrumStatus): Observable<HttpResponse<any>> {
|
||||
const url = `${environment.apiUrl}/status/${status.id}`;
|
||||
return this.httpClient.delete(url, { observe: 'response' });
|
||||
}
|
||||
// Projects
|
||||
public getProjects(): Observable<HttpResponse<ScrumProject[]>> {
|
||||
const url = `${environment.apiUrl}/projects`;
|
||||
return this.httpClient.get<ScrumProject[]>(url, { observe: 'response' });
|
||||
}
|
||||
|
||||
public getProject(id: number): Observable<HttpResponse<ScrumProject>> {
|
||||
const url = `${environment.apiUrl}/projects/${id}`;
|
||||
return this.httpClient.get<ScrumProject>(url, { observe: 'response' });
|
||||
}
|
||||
|
||||
// Users
|
||||
public getUsers(): Observable<HttpResponse<ScrumUser[]>> {
|
||||
const url = `${environment.apiUrl}/users`;
|
||||
return this.httpClient.get<ScrumUser[]>(url, { observe: 'response' });
|
||||
}
|
||||
public postProject(
|
||||
project: ScrumProject
|
||||
): Observable<HttpResponse<ScrumProject>> {
|
||||
const url = `${environment.apiUrl}/projects`;
|
||||
return this.httpClient.post<ScrumProject>(url, project, {
|
||||
observe: 'response',
|
||||
});
|
||||
}
|
||||
|
||||
public getUser(id: number): Observable<HttpResponse<ScrumUser>> {
|
||||
const url = `${environment.apiUrl}/users/${id}`;
|
||||
return this.httpClient.get<ScrumUser>(url, { observe: 'response' });
|
||||
}
|
||||
public putProject(project: ScrumProject): Observable<HttpResponse<any>> {
|
||||
const url = `${environment.apiUrl}/projects/${project.id}`;
|
||||
return this.httpClient.put(url, project, { observe: 'response' });
|
||||
}
|
||||
|
||||
public postUser(user: ScrumUser): Observable<HttpResponse<ScrumUser>> {
|
||||
const url = `${environment.apiUrl}/users`;
|
||||
return this.httpClient.post<ScrumUser>(url, user, { observe: 'response' });
|
||||
}
|
||||
|
||||
public putUser(user: ScrumUser): Observable<HttpResponse<any>> {
|
||||
const url = `${environment.apiUrl}/users/${user.id}`;
|
||||
return this.httpClient.put(url, user, { observe: 'response' });
|
||||
}
|
||||
|
||||
public deleteUser(user: ScrumUser): Observable<HttpResponse<any>> {
|
||||
const url = `${environment.apiUrl}/users/${user.id}`;
|
||||
return this.httpClient.delete(url, { observe: 'response' });
|
||||
}
|
||||
|
||||
|
||||
// Projects
|
||||
public getProjects(): Observable<HttpResponse<ScrumProject[]>> {
|
||||
const url = `${environment.apiUrl}/projects`;
|
||||
return this.httpClient.get<ScrumProject[]>(url, { observe: 'response' });
|
||||
}
|
||||
|
||||
public getProject(id: number): Observable<HttpResponse<ScrumProject>> {
|
||||
const url = `${environment.apiUrl}/projects/${id}`;
|
||||
return this.httpClient.get<ScrumProject>(url, { observe: 'response' });
|
||||
}
|
||||
|
||||
public postProject(project: ScrumProject): Observable<HttpResponse<ScrumProject>> {
|
||||
const url = `${environment.apiUrl}/projects`;
|
||||
return this.httpClient.post<ScrumProject>(url, project, { observe: 'response' });
|
||||
}
|
||||
|
||||
public putProject(project: ScrumProject): Observable<HttpResponse<any>> {
|
||||
const url = `${environment.apiUrl}/projects/${project.id}`;
|
||||
return this.httpClient.put(url, project, { observe: 'response' });
|
||||
}
|
||||
|
||||
public deleteProject(project: ScrumProject): Observable<HttpResponse<any>> {
|
||||
const url = `${environment.apiUrl}/projects/${project.id}`;
|
||||
return this.httpClient.delete(url, { observe: 'response' });
|
||||
}
|
||||
public deleteProject(project: ScrumProject): Observable<HttpResponse<any>> {
|
||||
const url = `${environment.apiUrl}/projects/${project.id}`;
|
||||
return this.httpClient.delete(url, { observe: 'response' });
|
||||
}
|
||||
}
|
||||
|
||||
export enum Priority {
|
||||
High="high",
|
||||
Medium="medium",
|
||||
Low="low"
|
||||
High = 'high',
|
||||
Medium = 'medium',
|
||||
Low = 'low',
|
||||
}
|
||||
|
||||
export interface ScrumTask {
|
||||
id?: number;
|
||||
title: string;
|
||||
content?: string;
|
||||
statusid?: number;
|
||||
categoryid?: number;
|
||||
assignedtoid?: number;
|
||||
sprintid?: number;
|
||||
projectid?: number;
|
||||
userstoryid?: number;
|
||||
priority?: Priority;
|
||||
id?: number;
|
||||
title: string;
|
||||
content?: string;
|
||||
statusid?: number;
|
||||
categoryid?: number;
|
||||
assignedtoid?: number;
|
||||
sprintid?: number;
|
||||
projectid?: number;
|
||||
userstoryid?: number;
|
||||
priority?: Priority;
|
||||
}
|
||||
|
||||
export interface ScrumUserstory {
|
||||
id?: number;
|
||||
title: string;
|
||||
content?: string;
|
||||
priority?: Priority;
|
||||
statusid?: number;
|
||||
categoryid?: number;
|
||||
createdbyid?: number;
|
||||
projectid?: number;
|
||||
id?: number;
|
||||
title: string;
|
||||
content?: string;
|
||||
priority?: Priority;
|
||||
statusid?: number;
|
||||
categoryid?: number;
|
||||
createdbyid?: number;
|
||||
projectid?: number;
|
||||
}
|
||||
|
||||
export interface ScrumSprint{
|
||||
id?: number;
|
||||
title: string;
|
||||
description?: string;
|
||||
startDate: Date;
|
||||
endDate: Date;
|
||||
project?: number;
|
||||
export interface ScrumSprint {
|
||||
id?: number;
|
||||
title: string;
|
||||
description?: string;
|
||||
startDate: Date;
|
||||
endDate: Date;
|
||||
project?: number;
|
||||
}
|
||||
|
||||
export interface ScrumCategory {
|
||||
id?: number;
|
||||
title: string;
|
||||
description?: string;
|
||||
color?: string;
|
||||
project: number;
|
||||
id?: number;
|
||||
title: string;
|
||||
description?: string;
|
||||
color?: string;
|
||||
project: number;
|
||||
}
|
||||
|
||||
export interface ScrumStatus {
|
||||
id? : number;
|
||||
title: string;
|
||||
description: string;
|
||||
id?: number;
|
||||
title: string;
|
||||
description: string;
|
||||
}
|
||||
|
||||
|
||||
export interface ScrumUser {
|
||||
id?: number;
|
||||
name: string;
|
||||
id?: number;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface ScrumProject {
|
||||
id?: number;
|
||||
title: string;
|
||||
isprivate: boolean;
|
||||
id?: number;
|
||||
title: string;
|
||||
isprivate: boolean;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user