mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-26 17:24:56 +00:00
This reverts commit 1e251ab8aa4efcccdb7d72a94a34f30c7b040673.
This commit is contained in:
parent
1e251ab8aa
commit
462f40827e
@ -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
|
- _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
|
- **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
|
## Details
|
||||||
|
|
||||||
The class returned by `getPerson` and `getCurrentPerson` is detailed
|
The class returned by `getPerson` and `getCurrentPerson` is detailed
|
||||||
|
@ -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) => {
|
it('should be able to create new person', (done) => {
|
||||||
spyOn(service.peopleApi, 'createPerson').and.returnValue(Promise.resolve(new PersonEntry({ entry: fakeEcmUser })));
|
spyOn(service.peopleApi, 'createPerson').and.returnValue(Promise.resolve(new PersonEntry({ entry: fakeEcmUser })));
|
||||||
service.createPerson(createNewPersonMock).subscribe((person) => {
|
service.createPerson(createNewPersonMock).subscribe((person) => {
|
||||||
|
@ -19,7 +19,7 @@ import { Injectable } from '@angular/core';
|
|||||||
import { Observable, from, throwError } from 'rxjs';
|
import { Observable, from, throwError } from 'rxjs';
|
||||||
import { AlfrescoApiService } from './alfresco-api.service';
|
import { AlfrescoApiService } from './alfresco-api.service';
|
||||||
import { catchError, map } from 'rxjs/operators';
|
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 { EcmUserModel } from '../models/ecm-user.model';
|
||||||
import { LogService } from './log.service';
|
import { LogService } from './log.service';
|
||||||
|
|
||||||
@ -45,7 +45,6 @@ export class PeopleContentService {
|
|||||||
hasCheckedIsContentAdmin: boolean = false;
|
hasCheckedIsContentAdmin: boolean = false;
|
||||||
|
|
||||||
private _peopleApi: PeopleApi;
|
private _peopleApi: PeopleApi;
|
||||||
private _queriesApi: QueriesApi;
|
|
||||||
|
|
||||||
constructor(private apiService: AlfrescoApiService, private logService: LogService) {}
|
constructor(private apiService: AlfrescoApiService, private logService: LogService) {}
|
||||||
|
|
||||||
@ -53,10 +52,6 @@ export class PeopleContentService {
|
|||||||
return this._peopleApi || (this._peopleApi = new PeopleApi(this.apiService.getInstance()));
|
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.
|
* Gets information about a user identified by their username.
|
||||||
* @param personId ID of the target user
|
* @param personId ID of the target user
|
||||||
@ -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.
|
* Creates new person.
|
||||||
* @param newPerson Object containing the new person details.
|
* @param newPerson Object containing the new person details.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user