import { HttpClient } from '@angular/common/http' ; import { Injectable } from '@angular/core' ; import { IAvailabilitySlot , IAvailabilitySlotsCreateInput , IAvailabilitySlotsFindInput } from '@gauzy/contracts' ; import { firstValueFrom } from 'rxjs' ; import { API_PREFIX } from '../constants/app.constants' ; @ Injectable ( ) export class AvailabilitySlotsService { AVAILABILITY_SLOTS_BASE_URI = `${ API_PREFIX }/availability-slots` ; constructor ( private http ) { } create ( createInput ) { return firstValueFrom ( this . http . post < IAvailabilitySlot > ( this . AVAILABILITY_SLOTS_BASE_URI , createInput ) ) ; } createBulk ( createInput ) { return firstValueFrom ( this . http . post < IAvailabilitySlot [ ] > ( this . AVAILABILITY_SLOTS_BASE_URI + '/bulk' , createInput ) ) ; } getAll ( relations ? , findInput ? ) { const data = JSON . stringify ( { relations , findInput } ) ; return firstValueFrom ( this . http . get < { items : IAvailabilitySlot [ ] ; total : number ; } > ( this . AVAILABILITY_SLOTS_BASE_URI , { params : { data } } ) ) ; } update ( id , updateInput ) { return firstValueFrom ( this . http . put ( `${ this . AVAILABILITY_SLOTS_BASE_URI }/${ id }` , updateInput ) ) ; } delete ( id ) { return firstValueFrom ( this . http . delete ( `${ this . AVAILABILITY_SLOTS_BASE_URI }/${ id }` ) ) ; } }