From 2cc4ffa0eb3d21c6abeffd4d892a88b2dbd12636 Mon Sep 17 00:00:00 2001 From: Piet Ostendorp Date: Fri, 24 Oct 2025 22:02:12 +0200 Subject: [PATCH] Add CRUD methods for Kinosaal in HttpService Introduced get, add, update, and delete methods for Kinosaal entities using a base API URL. Updated getAllKinosaal to return an array and refactored endpoints to use relative paths. --- src/app/http.service.ts | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/app/http.service.ts b/src/app/http.service.ts index ae330ea..f3e6fe5 100644 --- a/src/app/http.service.ts +++ b/src/app/http.service.ts @@ -6,12 +6,30 @@ import { Observable } from "rxjs"; @Injectable({providedIn: 'root'}) export class HttpService { private http = inject(HttpClient); + private baseUrl = '/api/'; - getAllKinosaal(): Observable { - return this.http.get(`https://infinimotion.de/api/kinosaal`); + /* GET /api/kinosaal */ + getAllKinosaal(): Observable { + return this.http.get(`${this.baseUrl}kinosaal`); } + /* GET /api/kinosaal/{id} */ + getKinosaalById(id: number): Observable { + return this.http.get(`${this.baseUrl}kinosaal/${id}`); + } + + /* POST /api/kinosaal */ addKinosaal(kinosaal: Omit): Observable { - return this.http.post(`https://infinimotion.de/api/kinosaal`, kinosaal); + return this.http.post(`${this.baseUrl}kinosaal`, kinosaal); + } + + /* PUT /api/kinosaal/{id} */ + updateKinosaal(id: number, kinosaal: Partial): Observable { + return this.http.put(`${this.baseUrl}kinosaal/${id}`, kinosaal); + } + + /* DELETE /api/kinosaal/{id} */ + deleteKinosaal(id: number): Observable { + return this.http.delete(`${this.baseUrl}kinosaal/${id}`); } }