43 lines
2.0 KiB
TypeScript
43 lines
2.0 KiB
TypeScript
import { HttpHeaders } from '@angular/common/http';
|
|
import { Injectable } from '@angular/core';
|
|
import { ConfigurationService } from '../configuration/configuration.service';
|
|
import { Observable } from 'rxjs';
|
|
import { DescriptionTemplateType } from '@app/core/model/description-template-type/description-template-type';
|
|
import { QueryResult } from '@common/model/query-result';
|
|
import { DescriptionTemplateTypeLookup } from '@app/core/query/description-template/description-template-type.lookup';
|
|
import { BaseHttpV2Service } from '../http/base-http-v2.service';
|
|
|
|
@Injectable()
|
|
export class DescriptionTemplateTypeService {
|
|
|
|
private get apiBase(): string { return `${this.configurationService.server}v2/descriptionTemplateType`; }
|
|
private headers = new HttpHeaders();
|
|
|
|
constructor(private http: BaseHttpV2Service, private configurationService: ConfigurationService) {}
|
|
|
|
getAll(lookup: DescriptionTemplateTypeLookup): Observable<QueryResult<DescriptionTemplateType>> {
|
|
const url = `${this.apiBase}/all`;
|
|
return this.http.post<QueryResult<DescriptionTemplateType>>(url, lookup, { headers: this.headers });
|
|
}
|
|
|
|
getSingle(id: string): Observable<QueryResult<DescriptionTemplateType>> {
|
|
const url = `${this.apiBase}/${id}`;
|
|
return this.http.get<QueryResult<DescriptionTemplateType>>(url , { headers: this.headers });
|
|
}
|
|
|
|
create(payload: DescriptionTemplateType): Observable<QueryResult<DescriptionTemplateType>> {
|
|
const url = `${this.apiBase}/create`;
|
|
return this.http.post<QueryResult<DescriptionTemplateType>>(url, payload, { headers: this.headers });
|
|
}
|
|
|
|
update(payload: DescriptionTemplateType): Observable<QueryResult<DescriptionTemplateType>> {
|
|
const url = `${this.apiBase}/update`;
|
|
return this.http.post<QueryResult<DescriptionTemplateType>>(url, payload, { headers: this.headers });
|
|
}
|
|
|
|
delete(id: string): Observable<void> {
|
|
const url = `${this.apiBase}/delete/${id}`;
|
|
return this.http.delete<void>(url, { headers: this.headers });
|
|
}
|
|
}
|