Open
Description
In my model below the properties I have:
"mixins": {
"ReadOnly" : {
"entered" : true,
"dbkey" : true
}
}
and when I run the application I get:
$ node .
/Users/jas/loopback/hts/node_modules/loopback-ds-readonly-mixin/lib/read-only.js:96
Object.keys(Model.definition.settings.relations).forEach(relationName => {
^
TypeError: Cannot convert undefined or null to object
at Function.keys (<anonymous>)
at EventEmitter.Model.on (/Users/jas/loopback/hts/node_modules/loopback-ds-readonly-mixin/lib/read-only.js:96:12)
at emitOne (events.js:96:13)
at EventEmitter.emit (events.js:188:7)
at Function.app.model (/Users/jas/loopback/hts/node_modules/loopback/lib/application.js:162:9)
at /Users/jas/loopback/hts/node_modules/loopback-boot/lib/executor.js:203:9
at Array.forEach (native)
at setupModels (/Users/jas/loopback/hts/node_modules/loopback-boot/lib/executor.js:199:23)
at execute (/Users/jas/loopback/hts/node_modules/loopback-boot/lib/executor.js:40:3)
at bootLoopBackApp (/Users/jas/loopback/hts/node_modules/loopback-boot/index.js:154:3)
at Object.<anonymous> (/Users/jas/loopback/hts/server/server.js:23:1)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
Is this a bug, or am I just missing something ?
I am using:
"loopback": "^3.19.0",
"loopback-boot": "^2.6.5",
"loopback-component-explorer": "^6.0.0",
"loopback-connector-mssql": "^2.9.0",
"loopback-ds-readonly-mixin": "^2.0.4",
I commented out the part about updates via relationship, and it now does not choke. However, when I try to insert a record using a PUT, and leave out readonly fields (because they are provided by the database) I get:
mdsdev4:hts jas$ node .
Web server listening at: http://localhost:3000
Browse your REST API at http://localhost:3000/explorer
Unhandled error for request POST /api/Runs?access_token=heyhey: ValidationError: The `Runs` instance is not valid. Details: `username` can't be blank (value: undefined); `entered` can't be blank (value: undefined); `dbkey` can't be blank (value: undefined).
Metadata
Metadata
Assignees
Labels
No labels