diff --git a/src/app/services/backend.service.ts b/src/app/services/backend.service.ts index 9881f47..239f82a 100644 --- a/src/app/services/backend.service.ts +++ b/src/app/services/backend.service.ts @@ -9,6 +9,8 @@ export class BackendService { constructor(private httpClient: HttpClient) {} + + // Tasks public getTasks(): Observable> { const url = `${environment.apiUrl}/tasks`; return this.httpClient.get(url, { observe: 'response' }); @@ -35,8 +37,7 @@ export class BackendService { } - - + // Userstories public getUserstories(): Observable> { const url = `${environment.apiUrl}/userstories`; return this.httpClient.get(url, { observe: 'response' }); @@ -62,6 +63,140 @@ export class BackendService { return this.httpClient.delete(url, {observe: 'response'}); } + + // Sprints + public getSprints(): Observable> { + const url = `${environment.apiUrl}/sprints`; + return this.httpClient.get(url, { observe: 'response' }); + } + + public getSprint(id: number): Observable> { + const url = `${environment.apiUrl}/sprints/${id}`; + return this.httpClient.get(url, { observe: 'response' }); + } + + public postSprint(sprint: ScrumSprint): Observable> { + const url = `${environment.apiUrl}/sprints`; + return this.httpClient.post(url, sprint, { observe: 'response' }); + } + + public putSprint(sprint: ScrumSprint): Observable> { + const url = `${environment.apiUrl}/sprints/${sprint.id}`; + return this.httpClient.put(url, sprint, { observe: 'response' }); + } + + public deleteSprint(sprint: ScrumSprint): Observable> { + const url = `${environment.apiUrl}/sprints/${sprint.id}`; + return this.httpClient.delete(url, {observe: 'response'}); + } + + + // Categories + public getCategories(): Observable> { + const url = `${environment.apiUrl}/categories`; + return this.httpClient.get(url, { observe: 'response' }); + } + + public getCategory(id: number): Observable> { + const url = `${environment.apiUrl}/categories/${id}`; + return this.httpClient.get(url, { observe: 'response' }); + } + + public postCategory(category: ScrumCategory): Observable> { + const url = `${environment.apiUrl}/categories`; + return this.httpClient.post(url, category, { observe: 'response' }); + } + + public putCategory(category: ScrumCategory): Observable> { + const url = `${environment.apiUrl}/categories/${category.id}`; + return this.httpClient.put(url, category, { observe: 'response' }); + } + + public deleteCategory(category: ScrumCategory): Observable> { + const url = `${environment.apiUrl}/categories/${category.id}`; + return this.httpClient.delete(url, { observe: 'response' }); + } + + + // Status + public getAllStatus(): Observable> { + const url = `${environment.apiUrl}/status`; + return this.httpClient.get(url, { observe: 'response' }); + } + + public getStatus(id: number): Observable> { + const url = `${environment.apiUrl}/status/${id}`; + return this.httpClient.get(url, { observe: 'response' }); + } + + public postStatus(status: ScrumStatus): Observable> { + const url = `${environment.apiUrl}/status`; + return this.httpClient.post(url, status, { observe: 'response' }); + } + + public putStatus(status: ScrumStatus): Observable> { + const url = `${environment.apiUrl}/status/${status.id}`; + return this.httpClient.put(url, status, { observe: 'response' }); + } + + public deleteStatus(status: ScrumStatus): Observable> { + const url = `${environment.apiUrl}/status/${status.id}`; + return this.httpClient.delete(url, { observe: 'response' }); + } + + + // Users + public getUsers(): Observable> { + const url = `${environment.apiUrl}/users`; + return this.httpClient.get(url, { observe: 'response' }); + } + + public getUser(id: number): Observable> { + const url = `${environment.apiUrl}/users/${id}`; + return this.httpClient.get(url, { observe: 'response' }); + } + + public postUser(user: ScrumUser): Observable> { + const url = `${environment.apiUrl}/users`; + return this.httpClient.post(url, user, { observe: 'response' }); + } + + public putUser(user: ScrumUser): Observable> { + const url = `${environment.apiUrl}/users/${user.id}`; + return this.httpClient.put(url, user, { observe: 'response' }); + } + + public deleteUser(user: ScrumUser): Observable> { + const url = `${environment.apiUrl}/users/${user.id}`; + return this.httpClient.delete(url, { observe: 'response' }); + } + + + // Projects + public getProjects(): Observable> { + const url = `${environment.apiUrl}/projects`; + return this.httpClient.get(url, { observe: 'response' }); + } + + public getProject(id: number): Observable> { + const url = `${environment.apiUrl}/projects/${id}`; + return this.httpClient.get(url, { observe: 'response' }); + } + + public postProject(project: ScrumProject): Observable> { + const url = `${environment.apiUrl}/projects`; + return this.httpClient.post(url, project, { observe: 'response' }); + } + + public putProject(project: ScrumProject): Observable> { + const url = `${environment.apiUrl}/projects/${project.id}`; + return this.httpClient.put(url, project, { observe: 'response' }); + } + + public deleteProject(project: ScrumProject): Observable> { + const url = `${environment.apiUrl}/projects/${project.id}`; + return this.httpClient.delete(url, { observe: 'response' }); + } } export enum Priority { @@ -127,6 +262,4 @@ export interface ScrumProject { id?: number; title: string; isprivate: boolean; -} - - +} \ No newline at end of file diff --git a/src/app/task-form/task-form.component.html b/src/app/task-form/task-form.component.html index 114d1d2..b0a5f4e 100644 --- a/src/app/task-form/task-form.component.html +++ b/src/app/task-form/task-form.component.html @@ -1,18 +1,23 @@