@@ -0,0 +1,24 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable, inject } from '@angular/core';
|
||||
import { Observable } from 'rxjs';
|
||||
import { API_BASE_URL } from '../../issues/issues-api.service';
|
||||
import { StatusEntity } from './statuses.store';
|
||||
|
||||
// Ce service appellera l'API quand les endpoints /api/statuses seront disponibles.
|
||||
// Voir api-issues/gestion-statuts.md
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class StatusesApiService {
|
||||
private readonly http = inject(HttpClient);
|
||||
|
||||
getAll(): Observable<StatusEntity[]> {
|
||||
return this.http.get<StatusEntity[]>(`${API_BASE_URL}/statuses`);
|
||||
}
|
||||
|
||||
create(status: Omit<StatusEntity, 'order'>): Observable<StatusEntity> {
|
||||
return this.http.post<StatusEntity>(`${API_BASE_URL}/statuses`, status);
|
||||
}
|
||||
|
||||
update(id: string, changes: Partial<Pick<StatusEntity, 'label' | 'bg' | 'color'>>): Observable<StatusEntity> {
|
||||
return this.http.put<StatusEntity>(`${API_BASE_URL}/statuses/${id}`, changes);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user