import { Injectable } from '@angular/core' ; import { HttpClient } from '@angular/common/http' ; import { IAppointmentEmployee } from '@gauzy/contracts' ; import { firstValueFrom } from 'rxjs' ; import { Observable } from 'rxjs' ; import { API_PREFIX } from '../constants/app.constants' ; @ Injectable ( ) export class AppointmentEmployeesService { URI = `${ API_PREFIX }/appointment-employees` ; constructor ( private http ) { } getAll ( ) { return firstValueFrom ( this . http . get < { items : IAppointmentEmployee [ ] ; } > ( this . URI ) ) ; } getById ( id = '' ) { return this . http . get < IAppointmentEmployee [ ] > ( this . URI + '/appointment/' + id ) ; } findEmployeeAppointments ( id = '' ) { return this . http . get < IAppointmentEmployee [ ] > ( this . URI + '/employee-appointments/' + id ) ; } add ( appointmentEmployees ) { return firstValueFrom ( this . http . post < IAppointmentEmployee > ( this . URI , appointmentEmployees ) ) ; } update ( id , appointmentEmployees ) { return firstValueFrom ( this . http . put < IAppointmentEmployee > ( `${ this . URI }/${ id }` , appointmentEmployees ) ) ; } delete ( id ) { return firstValueFrom ( this . http . delete ( `${ this . URI }/${ id }` ) ) ; } }