eslint-config-trybe
eslint-config-trybe copied to clipboard
Add "createOnly" properties option
I needed to be able to allow REST addition of properties on create, but disallow any update of those properties after creation. This PR implements a second value option for the "ReadOnly"
mixin when specifying properties:
"mixins": {
"ReadOnly": {
"status": true, // <-- ALWAYS read only from REST (all operations)
"role": "createOnly" // <-- can be set on creation from REST, but not updates from REST
}
}
should by extended to whiteListed methods ex. ReadOnly: { email: { writableBy: ['create', 'prototype.patchAttributes'] } }