Make movie schedule components functional
Introduces MovieGroup and Performance models for better type safety and data handling. Refactors movie-related components to use Angular signals (input/computed) and updates templates to bind data dynamically. Updates HttpService to support Vorstellung API endpoints. The schedule component now loads and groups performances by date and movie, passing structured data to child components for rendering.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Kinosaal } from '@infinimotion/model-frontend';
|
||||
import { Kinosaal, Vorstellung } from '@infinimotion/model-frontend';
|
||||
import { HttpClient } from "@angular/common/http";
|
||||
import { inject, Injectable } from "@angular/core";
|
||||
import { Observable } from "rxjs";
|
||||
@@ -6,7 +6,10 @@ import { Observable } from "rxjs";
|
||||
@Injectable({providedIn: 'root'})
|
||||
export class HttpService {
|
||||
private http = inject(HttpClient);
|
||||
private baseUrl = 'https://infinimotion.de/api/';
|
||||
private baseUrl = '/api/';
|
||||
|
||||
|
||||
/* Kinosaal APIs */
|
||||
|
||||
/* GET /api/kinosaal */
|
||||
getAllKinosaal(): Observable<Kinosaal[]> {
|
||||
@@ -32,4 +35,32 @@ export class HttpService {
|
||||
deleteKinosaal(id: number): Observable<void> {
|
||||
return this.http.delete<void>(`${this.baseUrl}kinosaal/${id}`);
|
||||
}
|
||||
|
||||
|
||||
/* Vorstellung APIs */
|
||||
|
||||
/* GET /api/vorstellung */
|
||||
getPerformaces(): Observable<Vorstellung[]> {
|
||||
return this.http.get<Vorstellung[]>(`${this.baseUrl}vorstellung`);
|
||||
}
|
||||
|
||||
/* GET /api/vorstellung/{id} */
|
||||
getPerformaceById(id: number): Observable<Vorstellung> {
|
||||
return this.http.get<Vorstellung>(`${this.baseUrl}vorstellung/${id}`);
|
||||
}
|
||||
|
||||
/* POST /api/vorstellung */
|
||||
addPerformace(vorstellung: Omit<Vorstellung, 'id'>): Observable<Vorstellung> {
|
||||
return this.http.post<Vorstellung>(`${this.baseUrl}vorstellung`, vorstellung);
|
||||
}
|
||||
|
||||
/* PUT /api/vorstellung/{id} */
|
||||
updatePerformace(id: number, vorstellung: Partial<Vorstellung>): Observable<Vorstellung> {
|
||||
return this.http.put<Vorstellung>(`${this.baseUrl}vorstellung/${id}`, vorstellung);
|
||||
}
|
||||
|
||||
/* DELETE /api/vorstellung/{id} */
|
||||
deletePerformace(id: number): Observable<void> {
|
||||
return this.http.delete<void>(`${this.baseUrl}vorstellung/${id}`);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user