generated from bisco/codex-bootstrap
feat: add frontend show detail page
This commit is contained in:
@@ -12,10 +12,32 @@ export type ShowListItem = {
|
||||
poster_image: string;
|
||||
};
|
||||
|
||||
export type VenueSummary = {
|
||||
name: string;
|
||||
city: string;
|
||||
};
|
||||
|
||||
export type ShowPerformance = {
|
||||
id: number;
|
||||
starts_at: string;
|
||||
venue: VenueSummary;
|
||||
booking_enabled: boolean;
|
||||
available_seats: number;
|
||||
};
|
||||
|
||||
export type ShowDetail = ShowListItem & {
|
||||
description: string;
|
||||
performances?: ShowPerformance[];
|
||||
};
|
||||
|
||||
type ShowListResponse = {
|
||||
results: ShowListItem[];
|
||||
};
|
||||
|
||||
type PerformanceListResponse = {
|
||||
results: ShowPerformance[];
|
||||
};
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root',
|
||||
})
|
||||
@@ -26,4 +48,14 @@ export class ShowsApiService {
|
||||
listShows(): Observable<ShowListResponse> {
|
||||
return this.http.get<ShowListResponse>(`${this.apiBaseUrl}/shows/`);
|
||||
}
|
||||
|
||||
getShow(slug: string): Observable<ShowDetail> {
|
||||
return this.http.get<ShowDetail>(`${this.apiBaseUrl}/shows/${slug}/`);
|
||||
}
|
||||
|
||||
listPerformancesForShow(slug: string): Observable<PerformanceListResponse> {
|
||||
return this.http.get<PerformanceListResponse>(`${this.apiBaseUrl}/performances/`, {
|
||||
params: { show: slug },
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user