AbstractProfileService

AbstractProfileService ⇐ Abstract

Kind: global abstract class
Extends: Abstract
Mixes: MServiceCache
Service:
Properties

NameTypeDescription
yearsNotKidAnymore,number

age when a profile is not considered as a kid anymore

sseUrlstring

url of sse stream

AbstractProfileService()

Service which handles CMS user profiles.

getAvailableProfiles(options) ⇒ Promise.<Array.<Profile>, Error>

List available users profile

Kind: instance method of AbstractProfileService
Returns: Promise.<Array.<Profile>, Error> - List of users profile

ParamTypeDefaultDescription
optionsobject

Some options...

[options.force]booleanfalse

If true, don't use the cache

[options.duration]number

Duration in milliseconds before invalidation of cache (if null, $$maxAge value is used by default)

getCurrentProfile(options) ⇒ Promise.<Profile, Error>

Get current user profile.

Kind: instance method of AbstractProfileService
Returns: Promise.<Profile, Error> - a user profile

ParamTypeDefaultDescription
optionsobject

Some options...

[options.force]booleanfalse

If true, don't use the cache

setCurrentProfile(profile) ⇒ Promise.<Profile, Error>

Set current user profile.

Kind: instance method of AbstractProfileService
Returns: Promise.<Profile, Error> - a user profile

ParamTypeDescription
profileProfile

a user profile

isKid(options) ⇒ Promise.<boolean, Error>

Check whether the current profile is a kids or not

Kind: instance method of AbstractProfileService
Returns: Promise.<boolean, Error> - return true if current profile age is smaller than yearsNotKidAnymore or if the current profile don’t have birthday return false otherwise

ParamTypeDescription
optionsobject

Some options for the getCurrentProfile function...

saveProfile(profile, [options]) ⇒ Promise.<Profile, Error>

Create or Update a profile

Kind: instance method of AbstractProfileService
Returns: Promise.<Profile, Error> - a user profile

ParamTypeDefaultDescription
profileProfile

Profile to save

[options]Object
[options.duration]number

Duration in milliseconds before invalidation of cache (if null, $$maxAge value is used by default)

deleteProfile(profile, [options]) ⇒ Promise.<Profile, Error>

Delete a profile

Kind: instance method of AbstractProfileService
Returns: Promise.<Profile, Error> - result

ParamTypeDefaultDescription
profileProfile

Profile to delete

[options]Object
[options.duration]number

Duration in milliseconds before invalidation of cache (if null, $$maxAge value is used by default)

getAvailableContexts(options) ⇒ Promise.<Array.<Profile>, Error>

List available users profile

Kind: instance method of AbstractProfileService
Returns: Promise.<Array.<Profile>, Error> - List of users profile

ParamTypeDefaultDescription
optionsobject

Some options...

[options.force]booleanfalse

If true, don't use the cache

[options.duration]number

Duration in milliseconds before invalidation of cache (if null, $$maxAge value is used by default)

getAllModelIdsContexts([options]) ⇒ Promise.<Object>

For each context, get all model id’s

Kind: instance method of AbstractProfileService
Returns: Promise.<Object> - map of contexts

ParamTypeDescription
[options]object

Some options...

getContextModelIds(contextType, [options]) ⇒ Promise.<Object>

Kind: instance method of AbstractProfileService
Returns: Promise.<Object> - A map { id: value }

ParamTypeDefaultDescription
contextTypeContextTypeConst

Filter FOLLOW/LIKE/DISLIKE...

[options]object

Some options...

[options.modelFilter]Model

Filter result by model type

[options.duration]number

Duration in milliseconds before invalidation of cache (if null, $$maxAge value is used by default)

getContextModels(contextType, [options]) ⇒ Promise.<Array>

Kind: instance method of AbstractProfileService
Returns: Promise.<Array> - A list of models

ParamTypeDefaultDescription
contextTypeContextTypeConst

Filter FOLLOW/LIKE/DISLIKE...

[options]object

Some options...

[options.modelFilter]Model

Filter result by model type

[options.duration]number

Duration in milliseconds before invalidation of cache (if null, $$maxAge value is used by default)

setContext(contextType, model, [options]) ⇒ Promise

Set profile’s context by type

Kind: instance method of AbstractProfileService

ParamTypeDescription
contextTypeContextTypeConst

Filter FOLLOW/LIKE/DISLIKE...

modelModel
[options]Object

unsetContext(contextType, model, [options]) ⇒ Promise

Unset profile’s context by type

Kind: instance method of AbstractProfileService

ParamTypeDescription
contextTypeContextTypeConst

Filter FOLLOW/LIKE/DISLIKE...

modelModel
[options]Object

getRecommended(ruleId, [options]) ⇒ Promise.<BusinessModel>

Get recommended Business Model by rule

Kind: instance method of AbstractProfileService

ParamTypeDefaultDescription
ruleIdstring
[options]Object

some options

[options.force]booleanfalse

If true, don't use the cache

_getAvailableProfiles(options) ⇒ Promise.<Array.<Profile>, Error>

Vendor implementation to get available profiles

Kind: instance abstract method of AbstractProfileService
Returns: Promise.<Array.<Profile>, Error> - List of users profile
Access: protected

ParamTypeDescription
optionsobject

Some options...

_getAvailableContexts(options) ⇒ Promise.<Array.<String>, Error>

Vendor implementation to get available contexts

Kind: instance abstract method of AbstractProfileService
Returns: Promise.<Array.<String>, Error> - List of contexts
Access: protected

ParamTypeDescription
optionsobject

Some options...

_saveProfile(profile, [options]) ⇒ Promise.<Profile, Error>

Vendor implementation to Create or Update a profile

Kind: instance abstract method of AbstractProfileService
Returns: Promise.<Profile, Error> - a user profile
Access: protected

ParamTypeDescription
profileProfile

Profile to save

[options]Object

_deleteProfile(profile, [options]) ⇒ Promise.<Profile, Error>

Vendor implementation to delete a profile

Kind: instance abstract method of AbstractProfileService
Returns: Promise.<Profile, Error> - result
Access: protected

ParamTypeDescription
profileProfile

Profile to delete

[options]Object

_getContextModels(profileId, contextType, [options]) ⇒ Promise

Kind: instance abstract method of AbstractProfileService
Access: protected

ParamTypeDescription
profileIdstring
contextTypeContextTypeConst

Filter FOLLOW/LIKE/DISLIKE...

[options]object

Some options...

_setContext(profileId, contextType, model, value, [options]) ⇒ Promise

Vendor implementation to set profile’s context

Kind: instance abstract method of AbstractProfileService
Access: protected

ParamTypeDescription
profileIdstring
contextTypeContextTypeConst

Filter FOLLOW/LIKE/DISLIKE...

modelModel
value*

value to set on context

[options]Object

_unsetContext(profileId, contextType, model, value, [options]) ⇒ Promise

Vendor implementation to unset profile’s context

Kind: instance abstract method of AbstractProfileService
Access: protected

ParamTypeDescription
profileIdstring
contextTypeContextTypeConst

Filter FOLLOW/LIKE/DISLIKE...

modelModel
value*

to unset on context

[options]Object

_getAllModelIdsContexts(profileId, [options]) ⇒ Promise.<Object>

Vendor implementation to get for each context, get all model id’s

Kind: instance abstract method of AbstractProfileService
Returns: Promise.<Object> - map of contexts
Access: protected

ParamTypeDescription
profileIdstring
[options]object

Some options...

_getContextModelIds(profileId, contextType, [options]) ⇒ Promise.<Object>

Vendor implementation to get for a context all model id’s

Kind: instance abstract method of AbstractProfileService
Returns: Promise.<Object> - A map { id: value }
Access: protected

ParamTypeDescription
profileIdstring
contextTypeContextTypeConst

Filter FOLLOW/LIKE/DISLIKE...

[options]object

Some options...

[options.modelFilter]Model

Filter result by model type

_onSseEvent(event)

Vendor implementation of sse callback

Kind: instance abstract method of AbstractProfileService
Access: protected

ParamType
eventObject

_getRecommended(profileId, ruleId, [options]) ⇒ Promise.<BusinessModel>

Implementation for get recommended Business Model by rule

Kind: instance abstract method of AbstractProfileService

ParamTypeDefaultDescription
profileIdstring
ruleIdstring
[options]Object

some options

[options.force]booleanfalse

If true, don't use the cache

“profileCleanContext”

Fired when current profile clean context cache

Kind: event emitted by AbstractProfileService
Properties

NameType
dataProfile

“profileAddContext” (data)

Fired when current profile add context

Kind: event emitted by AbstractProfileService

ParamTypeDescription
dataObject
data.profileProfile
data.contextTypeContextTypeConst

Filter FOLLOW/LIKE/DISLIKE...

data.modelModel

“profileAddContext” (data)

Fired when current profile remove context

Kind: event emitted by AbstractProfileService

ParamTypeDescription
dataObject
data.profileProfile
data.contextTypeContextTypeConst

Filter FOLLOW/LIKE/DISLIKE...

data.modelModel