Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "[AAE-5392] - Add find people api call" #7121

Merged
merged 1 commit into from
Jun 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions docs/core/services/people-content.service.md
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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