import { HttpClient } from '@angular/common/http' ; import { Injectable } from '@angular/core' ; import { User } from '@nx-mean-starter/models' ; import { flattenObject } from '@nx-mean-starter/shared' ; import { QueryParams } from 'api-query-params' ; import { Observable } from 'rxjs' ; @ Injectable ( { providedIn : 'root' , } ) export class UsersService { constructor ( private http ) { } getMe ( ) { return this . http . get < User > ( 'api/me' ) ; } patchMe ( user ) { return this . http . patch < User > ( 'api/me' , user ) ; } getOne ( id ) { return this . http . get < User > ( `api/users/${ id }` ) ; } getBatch ( params = { } ) { return this . http . get < User [ ] > ( `api/users` , { params : flattenObject ( params ) } ) ; } }