Skip to content

Commit

Permalink
Revert "[AAE-5392] - Add find people api call (#7119)" (#7121)
Browse files Browse the repository at this point in the history
This reverts commit 1e251ab.
  • Loading branch information
arditdomi committed Jun 24, 2021
1 parent 1e251ab commit 462f408
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 39 deletions.
5 changes: 0 additions & 5 deletions docs/core/services/people-content.service.md
Expand Up @@ -34,11 +34,6 @@ Gets information about a Content Services user.
- _requestQuery:_ [`PeopleContentQueryRequestModel`](../../../lib/core/services/people-content.service.ts) - (Optional) maxItems and skipCount used for pagination
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`EcmUserModel`](../../core/models/ecm-user.model.md)`[]>` - Array of people

- **findPeople**(searchTerm: string, requestQuery?: [`PeopleContentQueryRequestModel`](../../../lib/core/services/people-content.service.ts#32)): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`EcmUserModel`](../../core/models/ecm-user.model.md)`[]>`<br/>
Gets a list of people.
- _searchTerm:_ `string` - The term to search for
- _requestQuery:_ [`PeopleContentQueryRequestModel`](../../../lib/core/services/people-content.service.ts) - (Optional) maxItems and skipCount used for pagination
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`EcmUserModel`](../../core/models/ecm-user.model.md)`[]>` - Array of people
## Details

The class returned by `getPerson` and `getCurrentPerson` is detailed
Expand Down
9 changes: 0 additions & 9 deletions lib/core/services/people-content.service.spec.ts
Expand Up @@ -94,15 +94,6 @@ describe('PeopleContentService', () => {
});
});

it('should search for users with search term and pagination info', (done) => {
const findPeopleSpy = spyOn(service.queriesApi, 'findPeople').and.returnValue(Promise.resolve({ ...fakeEcmUserList }));

service.findPeople('fake-term', { skipCount: 5, maxItems: 10 }).subscribe(() => {
expect(findPeopleSpy).toHaveBeenCalledWith('fake-term', { skipCount: 5, maxItems: 10 });
done();
});
});

it('should be able to create new person', (done) => {
spyOn(service.peopleApi, 'createPerson').and.returnValue(Promise.resolve(new PersonEntry({ entry: fakeEcmUser })));
service.createPerson(createNewPersonMock).subscribe((person) => {
Expand Down
26 changes: 1 addition & 25 deletions lib/core/services/people-content.service.ts
Expand Up @@ -19,7 +19,7 @@ import { Injectable } from '@angular/core';
import { Observable, from, throwError } from 'rxjs';
import { AlfrescoApiService } from './alfresco-api.service';
import { catchError, map } from 'rxjs/operators';
import { PersonEntry, PeopleApi, PersonBodyCreate, Pagination, QueriesApi } from '@alfresco/js-api';
import { PersonEntry, PeopleApi, PersonBodyCreate, Pagination } from '@alfresco/js-api';
import { EcmUserModel } from '../models/ecm-user.model';
import { LogService } from './log.service';

Expand All @@ -45,18 +45,13 @@ export class PeopleContentService {
hasCheckedIsContentAdmin: boolean = false;

private _peopleApi: PeopleApi;
private _queriesApi: QueriesApi;

constructor(private apiService: AlfrescoApiService, private logService: LogService) {}

get peopleApi() {
return this._peopleApi || (this._peopleApi = new PeopleApi(this.apiService.getInstance()));
}

get queriesApi() {
return this._queriesApi || (this._queriesApi = new QueriesApi(this.apiService.getInstance()));
}

/**
* Gets information about a user identified by their username.
* @param personId ID of the target user
Expand Down Expand Up @@ -96,25 +91,6 @@ export class PeopleContentService {
);
}

/**
* Gets a list of people that match the given search criteria.
* @param searchTerm The term to search for
* @param requestQuery maxItems and skipCount parameters supported by JS-API
* @returns Response containing pagination and list of entries
*/
findPeople(searchTerm: string, requestQuery?: PeopleContentQueryRequestModel): Observable<PeopleContentQueryResponse> {
const promise = this.queriesApi.findPeople(searchTerm, { ...requestQuery });
return from(promise).pipe(
map(response => {
return {
pagination: response.list.pagination,
entries: response.list.entries.map((person: PersonEntry) => <EcmUserModel> person.entry)
};
}),
catchError((err) => this.handleError(err))
);
}

/**
* Creates new person.
* @param newPerson Object containing the new person details.
Expand Down

0 comments on commit 462f408

Please sign in to comment.