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:
-
data
Object -
isUpdate
Booleantrue 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:
-
params
Object -
objs
Array(Object) -
[options]
Object optional
Returns:
models
createFromResult
-
obj
-
[options]
Create model instance from result from client
Parameters:
-
obj
Object -
[options]
Object optional
Returns:
model
delete
-
entity
-
[options]
Destroy the given entity (which must have "id" value)
Parameters:
-
entity
Entity -
[options]
Object optional
Returns:
isDeleted
deprecated
-
methodName
-
message
Show indication message of deprecated method
Parameters:
-
methodName
String -
message
String
Returns:
error
-
reason
-
[message]
create instance of DomainError
Parameters:
-
reason
Stringreason of the error
-
[message]
String optional
Returns:
get
-
id
-
[options]
get entity by id.
Parameters:
-
id
String | 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:
-
id
String | Number -
[options]
Object optional-
[client=@client]
ResourceClientInterface optional
-
Returns:
entity
getByIds
-
ids
-
[options]
get entities by id.
Parameters:
-
ids
Array | (String | Number) -
[options]
Object optional
Returns:
entities
getBySessionId
-
sessionId
-
[options]
get user model by sessionId
Parameters:
-
sessionId
String -
[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:
-
entity
Entity | Object
Returns:
client
getClientByForeignKey
-
foreignKey
get client by foreignKey
Parameters:
-
foreignKey
String
Returns:
client
getClientByQuery
-
query
get client by query
Parameters:
-
query
Object-
[foreignKey]
String optional
-
Returns:
client
getDiff
-
entity
-
[options]
get diff from perpetuation layer
Parameters:
-
entity
Entity -
[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:
-
params
Object-
modelName
Stringforeign model name
-
id
Stringforeign 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:
-
data
Entity | Object
parseSessionId
-
sessionId
get accessToken and userId by sessionId
Parameters:
-
sessionId
String
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:
-
entity
Entity | 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:
-
id
Anyid of the entity to update
-
data
Objectkey-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:
-
entity
Entity -
data
Objectkey-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.