import { HttpClient } from '@angular/common/http' ; import { Injectable } from '@angular/core' ; import { IEmployeeProposalTemplate , IPagination } from '@gauzy/contracts' ; import { toParams } from '@gauzy/common-angular' ; import { firstValueFrom } from 'rxjs' ; import { API_PREFIX } from '../../../@core/constants' ; @ Injectable ( { providedIn : 'root' } ) export class ProposalTemplateService { API_URL = `${ API_PREFIX }/employee-proposal-template` ; constructor ( private http ) { } getAll ( request = { } ) { return firstValueFrom ( this . http . get < IPagination < IEmployeeProposalTemplate > > ( this . API_URL , { params : toParams ( request ) } ) ) ; } create ( request ) { return firstValueFrom ( this . http . post < IEmployeeProposalTemplate > ( this . API_URL , request ) ) ; } update ( id , request ) { return firstValueFrom ( this . http . put < IEmployeeProposalTemplate > ( `${ this . API_URL }/${ id }` , request ) ) ; } makeDefault ( id ) { return firstValueFrom ( this . http . post < IEmployeeProposalTemplate > ( `${ this . API_URL }/${ id }/make-default` , { } ) ) ; } delete ( id ) { return firstValueFrom ( this . http . delete ( `${ this . API_URL }/${ id }` ) ) ; } }