import { HttpClient } from '@angular/common/http' ; import { Injectable } from '@angular/core' ; import { IEditEntityByMemberInput , IOrganizationDepartment , IOrganizationDepartmentCreateInput , IOrganizationDepartmentFindInput } from '@gauzy/contracts' ; import { firstValueFrom } from 'rxjs' ; import { API_PREFIX } from '../constants/app.constants' ; @ Injectable ( { providedIn : 'root' } ) export class OrganizationDepartmentsService { constructor ( private http ) { } create ( createInput ) { return firstValueFrom ( this . http . post < IOrganizationDepartment > ( `${ API_PREFIX }/organization-department` , createInput ) ) ; } getAllByEmployee ( id ) { return firstValueFrom ( this . http . get < IOrganizationDepartment [ ] > ( `${ API_PREFIX }/organization-department/employee/${ id }` ) ) ; } getAll ( relations ? , findInput ? , order ? ) { const data = JSON . stringify ( { relations , findInput , order } ) ; return firstValueFrom ( this . http . get < { items : IOrganizationDepartment [ ] ; total : number ; } > ( `${ API_PREFIX }/organization-department` , { params : { data } } ) ) ; } update ( id , updateInput ) { return firstValueFrom ( this . http . put ( `${ API_PREFIX }/organization-department/${ id }` , updateInput ) ) ; } updateByEmployee ( updateInput ) { return firstValueFrom ( this . http . put ( `${ API_PREFIX }/organization-department/employee` , updateInput ) ) ; } delete ( id ) { return firstValueFrom ( this . http . delete ( `${ API_PREFIX }/organization-department/${ id }` ) ) ; } }