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.
This commit is contained in:
@@ -6,12 +6,30 @@ import { Observable } from "rxjs";
|
||||
@Injectable({providedIn: 'root'})
|
||||
export class HttpService {
|
||||
private http = inject(HttpClient);
|
||||
private baseUrl = '/api/';
|
||||
|
||||
getAllKinosaal(): Observable<Kinosaal> {
|
||||
return this.http.get<Kinosaal>(`https://infinimotion.de/api/kinosaal`);
|
||||
/* GET /api/kinosaal */
|
||||
getAllKinosaal(): Observable<Kinosaal[]> {
|
||||
return this.http.get<Kinosaal[]>(`${this.baseUrl}kinosaal`);
|
||||
}
|
||||
|
||||
/* GET /api/kinosaal/{id} */
|
||||
getKinosaalById(id: number): Observable<Kinosaal> {
|
||||
return this.http.get<Kinosaal>(`${this.baseUrl}kinosaal/${id}`);
|
||||
}
|
||||
|
||||
/* POST /api/kinosaal */
|
||||
addKinosaal(kinosaal: Omit<Kinosaal, 'id'>): Observable<Kinosaal> {
|
||||
return this.http.post<Kinosaal>(`https://infinimotion.de/api/kinosaal`, kinosaal);
|
||||
return this.http.post<Kinosaal>(`${this.baseUrl}kinosaal`, kinosaal);
|
||||
}
|
||||
|
||||
/* PUT /api/kinosaal/{id} */
|
||||
updateKinosaal(id: number, kinosaal: Partial<Kinosaal>): Observable<Kinosaal> {
|
||||
return this.http.put<Kinosaal>(`${this.baseUrl}kinosaal/${id}`, kinosaal);
|
||||
}
|
||||
|
||||
/* DELETE /api/kinosaal/{id} */
|
||||
deleteKinosaal(id: number): Observable<void> {
|
||||
return this.http.delete<void>(`${this.baseUrl}kinosaal/${id}`);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user