import{Injectable}from'@angular/core';import{Horse}from'../dto/horse';import{HttpClient}from'@angular/common/http';import{Globals}from'../global/globals';import{Observable}from'rxjs';@Injectable({providedIn:'root'})exportclassHorseService{privatemessageBaseUri:string=this.globals.backendUri+'/horses';constructor(privatehttpClient:HttpClient,privateglobals:Globals){}/** * Loads specific horse from the backend * @param id of horse to load */getHorseById(id:number):Observable<Horse>{console.log('Load horse details for '+id);returnthis.httpClient.get<Horse>(this.messageBaseUri+'/'+id);}/** * Adds a specific horse to the backend and loads it if successful * @param horse */addHorse(horse:Horse):Observable<Horse>{console.log('Add new horse '+horse);returnthis.httpClient.post<Horse>(this.messageBaseUri,horse);}}