generated from nhcarrigan/template
feat: add manga and shows collections
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* @copyright 2026 NHCarrigan
|
||||
* @license Naomi's Public License
|
||||
* @author Naomi Carrigan
|
||||
*/
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Observable } from 'rxjs';
|
||||
import { ApiService } from './api.service';
|
||||
import { Show, CreateShowDto, UpdateShowDto } from '@library/shared-types';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class ShowsService {
|
||||
constructor(private api: ApiService) {}
|
||||
|
||||
getAllShows(): Observable<Show[]> {
|
||||
return this.api.get<Show[]>('/shows');
|
||||
}
|
||||
|
||||
getShowById(id: string): Observable<Show | null> {
|
||||
return this.api.get<Show | null>(`/shows/${id}`);
|
||||
}
|
||||
|
||||
createShow(show: CreateShowDto): Observable<Show> {
|
||||
return this.api.post<Show>('/shows', show);
|
||||
}
|
||||
|
||||
updateShow(id: string, show: UpdateShowDto): Observable<Show> {
|
||||
return this.api.put<Show>(`/shows/${id}`, show);
|
||||
}
|
||||
|
||||
deleteShow(id: string): Observable<{ success: boolean }> {
|
||||
return this.api.delete<{ success: boolean }>(`/shows/${id}`);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user