Newer
Older
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Observable } from 'rxjs';
import { ApplicationConfigService } from 'app/core/config/application-config.service';
import { ReviewRequest } from './reviewRequest.model';
import { Review } from './review.model';
@Injectable({ providedIn: 'root' })
export class ReviewManagementService {
resourceUrl = this.applicationConfigService.getEndpointFor('api/review');
constructor(private http: HttpClient, private applicationConfigService: ApplicationConfigService) {}
create(reviewRequest: ReviewRequest): Observable<ReviewRequest> {
return this.http.post<ReviewRequest>(this.resourceUrl + '/create', reviewRequest);
}
update(review: Review): Observable<Review> {
return this.http.put<Review>(this.resourceUrl, review);
}
delete(id: number): Observable<{}> {
return this.http.delete(`${this.resourceUrl}/${id}`);
}
find(id: number): Observable<Review> {
return this.http.get<Review>(`${this.resourceUrl}/${id}`);
}
getAll(): Observable<Review[]> {
return this.http.get<Review[]>(this.resourceUrl + '/all');
}
}