LoopbackUserRepository Class
Item Index
Methods
- appendTimeStamp
- count
- createFromQueryResults
- createFromResult
- delete
- deprecated
- error
- get
- getAll
- getById
- getByIds
- getBySessionId
- getClientByEntity
- getClientByForeignKey
- getClientByQuery
- getDiff
- getFacade deprecated
- getModelClass
- getModule
- getParent
- getRelatedClient
- modifyDate
- parseSessionId
- query
- save
- setRoot
- singleQuery
- update
- updateProps
Methods
appendTimeStamp
-
data -
isUpdate
add createdAt, updatedAt to given data
- createdAt will not be overriden if already set.
- updatedAt will be overriden for each time
Parameters:
-
dataObject -
isUpdateBooleantrue when updating
Returns:
data
count
-
[where]
Return the number of models that match the optional "where" filter.
Parameters:
-
[where]Object optional
Returns:
createFromQueryResults
-
params -
objs -
[options]
Create model instances from query results
Parameters:
-
paramsObject -
objsArray(Object) -
[options]Object optional
Returns:
models
createFromResult
-
obj -
[options]
Create model instance from result from client
Parameters:
-
objObject -
[options]Object optional
Returns:
model
delete
-
entity -
[options]
Destroy the given entity (which must have "id" value)
Parameters:
-
entityEntity -
[options]Object optional
Returns:
isDeleted
deprecated
-
methodName -
message
Show indication message of deprecated method
Parameters:
-
methodNameString -
messageString
Returns:
error
-
reason -
[message]
create instance of DomainError
Parameters:
-
reasonStringreason of the error
-
[message]String optional
Returns:
get
-
id -
[options]
get entity by id.
Parameters:
-
idString | Number -
[options]Object optional-
[foreignKey]String optional
-
Returns:
entity
getAll
()
Promise(Array(Entity))
get all entities
Returns:
array of entities
getById
-
id -
[options]
alias for get()
Parameters:
-
idString | Number -
[options]Object optional-
[client=@client]ResourceClientInterface optional
-
Returns:
entity
getByIds
-
ids -
[options]
get entities by id.
Parameters:
-
idsArray | (String | Number) -
[options]Object optional
Returns:
entities
getBySessionId
-
sessionId -
[options]
get user model by sessionId
Parameters:
-
sessionIdString -
[options]Object optional-
[include]Boolean | String optionalinclude related models or not.
-
Returns:
getClientByEntity
-
entity
get client by entity if entity has foreign key, relClient is returned.
Parameters:
-
entityEntity | Object
Returns:
client
getClientByForeignKey
-
foreignKey
get client by foreignKey
Parameters:
-
foreignKeyString
Returns:
client
getClientByQuery
-
query
get client by query
Parameters:
-
queryObject-
[foreignKey]String optional
-
Returns:
client
getDiff
-
entity -
[options]
get diff from perpetuation layer
Parameters:
-
entityEntity -
[options]Object optional-
[client=@client]ResourceClientInterface optional
-
Returns:
diff
getModelClass
()
Class
get model class this factory handles
Returns:
getParent
()
Function
get parent class
Returns:
getRelatedClient
-
params
Get loopback-related-client
Parameters:
-
paramsObject-
modelNameStringforeign model name
-
idStringforeign id
-
[relation]String optionalrelation name
-
[foreignKey]String optionalforeign key prop.
-
[through]String optional -
[keyThrough]String optional
-
Returns:
modifyDate
-
data
convert 'date' type property for loopback format
Parameters:
-
dataEntity | Object
parseSessionId
-
sessionId
get accessToken and userId by sessionId
Parameters:
-
sessionIdString
Returns:
[accessToken, userId]
query
-
[params] -
[options]
Find all model instances that match params
Parameters:
-
[params]Object optionalquery parameters
-
[options]Object optional
Returns:
array of entities
save
-
entity
Update or insert a model instance reserves password property, as loopback does not return password
Parameters:
-
entityEntity | Object
Returns:
entity (the same instance from input, if entity given,)
setRoot
()
protected
singleQuery
-
[params] -
[options]
Find one model instance that matches params, Same as query, but limited to one result
Parameters:
-
[params]Object optionalquery parameters
-
[options]Object optional
Returns:
entity
update
-
id -
data -
[options]
Update set of attributes.
Parameters:
-
idAnyid of the entity to update
-
dataObjectkey-value pair to update
-
[options]Object optional
Returns:
updated entity
updateProps
-
entity -
data -
[options]
Update set of attributes and returns newly-updated props (other than props)
Parameters:
-
entityEntity -
dataObjectkey-value pair to update (notice: this must not be instance of Entity)
-
[options]Object optional-
[client=@client]ResourceClientInterface optional
-
Returns:
updated props
Properties
belongsTo
String
protected
prop name this model belongs to
client
ResourceClientInterface
protected
client accessing to data resource (RDB, NoSQL, memory, etc...)
mock object is input by default. Extenders must set this property to achieve perpetuation
factory
FactoryInterface
factory of the entity.
