src/app/modules/search/services/user-search/user-search.service.ts
Service to get course consumption dashboard
It responsible to make http call
Properties |
Methods |
constructor(learnerService: LearnerService, config: ConfigService)
|
|||||||||
Parameters :
|
deleteUser | ||||
deleteUser(requestParam)
|
||||
Parameters :
Returns :
any
|
getUserById | ||||
getUserById(requestParam)
|
||||
Parameters :
Returns :
any
|
getUserByIdV5 | ||||
getUserByIdV5(requestParam)
|
||||
Parameters :
Returns :
any
|
getUserType |
getUserType()
|
Returns :
any
|
updateRoles | ||||
updateRoles(requestParam)
|
||||
Parameters :
Returns :
any
|
Public config |
Type : ConfigService
|
To get api urls |
userDeleteEvent |
Default value : new EventEmitter()
|
To listen event |
userDetailsObject |
Type : any
|
import {map} from 'rxjs/operators';
import { Injectable, EventEmitter } from '@angular/core';
import { ConfigService } from '@sunbird/shared';
import { LearnerService } from '@sunbird/core';
/**
* Service to get course consumption dashboard
*
* It responsible to make http call
*/
@Injectable()
/**
* @class UserSearchService
*/
export class UserSearchService {
userDetailsObject: any;
/**
* To listen event
*/
userDeleteEvent = new EventEmitter();
/**
* To get api urls
*/
public config: ConfigService;
constructor(private learnerService: LearnerService,
config: ConfigService) {
this.config = config;
}
deleteUser(requestParam) {
const option = {
url: this.config.urlConFig.URLS.ADMIN.DELETE_USER,
data: {
'request': {
'userId': requestParam.userId
}
}
};
return this.learnerService.post(option).pipe(map(data => {
this.userDeleteEvent.emit(requestParam.userId);
return data;
}));
}
updateRoles(requestParam) {
const option = {
url: this.config.urlConFig.URLS.ADMIN.UPDATE_USER_ORG_ROLES,
data: {
'request': {
'userId': requestParam.userId,
'organisationId': requestParam.orgId,
'roles': requestParam.roles
}
}
};
return this.learnerService.post(option);
}
getUserById(requestParam) {
const option = {
url: this.config.urlConFig.URLS.USER.GET_PROFILE + requestParam.userId + '?fields=organisations,roles,locations'
};
return this.learnerService.get(option);
}
getUserByIdV5(requestParam) {
const option = {
url: this.config.urlConFig.URLS.USER.GET_PROFILE_V5 + requestParam.userId + '?fields=organisations,roles,locations'
};
return this.learnerService.get(option);
}
getUserType() {
const option = {
url: this.config.urlConFig.URLS.USER.TYPE
};
return this.learnerService.get(option);
}
}