model
mixin in ORM model
Table of Contents
- Methods
- Properties
Methods
_filterParams
-
params
filter request params
Parameters:
-
params
Object
Returns:
Object filtered params
createRecord
-
init
create new model with init options and model property
Parameters:
-
init
Objectinit data
Returns:
Object current model
deleteRecord
-
model
-
data
delete the record from backend
Returns:
Promise
deleteSerializer
-
data
serializer for delete
Parameters:
-
data
Objectresponse data from backend
Returns:
serializer data
find
-
params
find the records from backend according to params
Parameters:
-
params
Objectquery params
Returns:
Promise
findOne
-
id
-
data
find only one according to primary id
Returns:
Promise
findOneSerializer
-
data
serializer for findOne method
Parameters:
-
data
Objectresponse data from backend
Returns:
serializer data
findSerializer
-
data
find serializer
Parameters:
-
data
Objectresponse data from backend
Returns:
serializer data
save the record to backend when create or update object
Parameters:
-
model
Objectmodel needed to save
Returns:
saveSerializer
-
data
serializer for save method
Parameters:
-
data
Objectresponse data from backend
Returns:
serializer data
urlForDelete
-
id
url for delete method request, use this method to custome delete url
Parameters:
-
id
Objectobject primary key
Returns:
String
urlForFind
()
url for find method request, use this method to custome find url
Returns:
String
urlForFindOne
()
url for findOne method request, use this method to custome findOne url
Returns:
String
urlForSave
-
id
url for save method request, use this method to custome create and update url
Parameters:
-
id
Objectobject primary key
Returns:
String
Properties
displayModel
Object
The object is for extract response data {user: [], comment:[], avatar: {}}
Default: null
rootKey
String
The response data business logic root key like: {'code': 0, 'resp':{'user':[]}, 'msg':''}, the resp is is the rootKey
Default: ""
url
String
The api url. If rootURL ends with slash , the url should not starts with slash
Default: ""