import { Injectable } from '@angular/core' ; import { HttpClient } from '@angular/common/http' ; import { IEmployeePresetInput , IGetJobPresetInput , IJobPreset , IMatchingCriterions } from '@gauzy/contracts' ; import { toParams } from '@gauzy/common-angular' ; import { API_PREFIX } from '../constants/app.constants' ; import { firstValueFrom } from 'rxjs' ; @ Injectable ( { providedIn : 'root' } ) export class JobPresetService { constructor ( private http ) { } getJobPresets ( request ? ) { return firstValueFrom ( this . http . get < IJobPreset [ ] > ( `${ API_PREFIX }/job-preset` , { params : request ? toParams ( request ) : { } } ) ) ; } getJobPreset ( id , request ? ) { return firstValueFrom ( this . http . get < IJobPreset > ( `${ API_PREFIX }/job-preset/${ id }` , { params : request ? toParams ( request ) : { } } ) ) ; } getEmployeePreset ( request ? ) { return firstValueFrom ( this . http . get < IJobPreset > ( `${ API_PREFIX }/job-preset` , { params : request ? toParams ( request ) : { } } ) ) ; } getEmployeeCriterions ( employeeId , request ? ) { return firstValueFrom ( this . http . get < IMatchingCriterions [ ] > ( `${ API_PREFIX }/job-preset/employee/${ employeeId }/criterion` , { params : request ? toParams ( request ) : { } } ) ) ; } createJobPreset ( request ? ) { return firstValueFrom ( this . http . post < IJobPreset > ( `${ API_PREFIX }/job-preset` , request ) ) ; } saveEmployeePreset ( arg ) { return firstValueFrom ( this . http . post < IMatchingCriterions [ ] > ( `${ API_PREFIX }/job-preset/employee` , arg ) ) ; } createJobPresetCriterion ( jobPresetId , criterion ) { return firstValueFrom ( this . http . post < IJobPreset > ( `${ API_PREFIX }/job-preset/${ jobPresetId }/criterion` , criterion ) ) ; } createEmployeeCriterion ( employeeId , criterion ) { return firstValueFrom ( this . http . post < IMatchingCriterions > ( `${ API_PREFIX }/job-preset/employee/${ employeeId }/criterion` , criterion ) ) ; } deleteJobPresetCriterion ( criterionId ) { return firstValueFrom ( this . http . delete < IJobPreset > ( `${ API_PREFIX }/job-preset/criterion/${ criterionId }` ) ) ; } deleteEmployeeCriterion ( employeeId , criterionId ) { return firstValueFrom ( this . http . delete < IMatchingCriterions > ( `${ API_PREFIX }/job-preset/employee/${ employeeId }/criterion/${ criterionId }` ) ) ; } }