loopback-mixin-common
loopback.io common useful mixin
Install
# cd /path/to/loopback/project/root
# npm install loopback-mixin-common
Config
server/model-config.json
{
"_meta": {
...
"mixins": [
// add follow line
"loopback-mixin-common/mixins",
...
]
...
}
...
}
Usage
common/models/mymodel.json
{
"name": "note",
"base": "PersistedModel",
...
"mixins": {
"Timestamp": {
"modified": 0
},
"DefaultScope": {
"query": {
"limit": 25,
},
"currentUser": {
"userId": "id" // Mymodel.userId: currentUser.id
}
}
},
"properties": {
...
},
...
}`