New programming screen

This commit is contained in:
2026-06-21 21:55:55 +00:00
parent 96d0fef792
commit e627fe3637
24 changed files with 1297 additions and 122 deletions
+62
View File
@@ -0,0 +1,62 @@
import { Injectable, inject } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
import { Show } from '../interfaces/show';
import { getAppConfig } from './app-config.service';
export interface ShowScheduleCreate {
day_of_week: number;
time: string;
}
export interface ShowCreatePayload {
title: string;
description: string;
host: string;
genre: string;
show_art_url: string | null;
hero_image_url: string | null;
display_order: number;
schedules: ShowScheduleCreate[];
}
export interface ShowUpdatePayload {
title?: string;
description?: string;
host?: string;
genre?: string;
show_art_url?: string | null;
hero_image_url?: string | null;
display_order?: number;
active?: boolean;
schedules?: ShowScheduleCreate[];
}
@Injectable({
providedIn: 'root',
})
export class ShowService {
private http = inject(HttpClient);
private baseUrl = `${getAppConfig().apiBaseUrl}/api/shows`;
getShows(): Observable<Show[]> {
return this.http.get<Show[]>(this.baseUrl);
}
getShow(id: number): Observable<Show> {
return this.http.get<Show>(`${this.baseUrl}/${id}`);
}
createShow(payload: ShowCreatePayload): Observable<Show> {
return this.http.post<Show>(this.baseUrl, payload);
}
updateShow(id: number, payload: ShowUpdatePayload): Observable<Show> {
return this.http.put<Show>(`${this.baseUrl}/${id}`, payload);
}
deleteShow(id: number): Observable<void> {
return this.http.delete<void>(`${this.baseUrl}/${id}`);
}
}