import { Injectable } from '@angular/core' ; import { HttpClient } from '@angular/common/http' ; import { IOrganizationTeam , IOrganizationTeamFindInput , IOrganizationTeamCreateInput } from '@gauzy/contracts' ; import { firstValueFrom } from 'rxjs' ; import { API_PREFIX } from '../constants/app.constants' ; @ Injectable ( { providedIn : 'root' } ) export class OrganizationTeamsService { constructor ( private http ) { } create ( createInput ) { return firstValueFrom ( this . http . post < IOrganizationTeam > ( `${ API_PREFIX }/organization-team/create` , createInput ) ) ; } getAll ( relations ? , findInput ? ) { const data = JSON . stringify ( { relations , findInput } ) ; return firstValueFrom ( this . http . get < { items : IOrganizationTeam [ ] ; total : number ; } > ( `${ API_PREFIX }/organization-team` , { params : { data } } ) ) ; } update ( id , updateInput ) { return firstValueFrom ( this . http . put ( `${ API_PREFIX }/organization-team/${ id }` , updateInput ) ) ; } delete ( id ) { return firstValueFrom ( this . http . delete ( `${ API_PREFIX }/organization-team/${ id }` ) ) ; } getMyTeams ( relations ? , findInput ? , employeeId = '' ) { const data = JSON . stringify ( { relations , findInput , employeeId } ) ; return firstValueFrom ( this . http . get < { items : IOrganizationTeam [ ] ; total : number ; } > ( `${ API_PREFIX }/organization-team/me` , { params : { data } } ) ) ; } }