orm - Conditional sails model schemas -
i'm trying write conditional model schema based if exists other models.
for example, if exist model 'message' add together inbox/outbox:
class="lang-js prettyprint-override">var userschema = { attributes: { ... } } var messageschema = { attributes: { inbox: { collection: 'message' }, outbox: { collection: 'message' } } }; if (<function check message model available) _.merge userschema, messageschema
is possible this?
i think need 1 "pre model load" fase on plugins , 1 hook alow others modules alter construction drupal 7 scheme.
you cold exports 1 function plug "fase feature" in plugin npm loader did default configs: https://github.com/wejs/we-plugin/blob/master/lib/index.js#l18 , set in https://github.com/wejs/we-example/blob/master/app.js#l63
orm sails.js waterline
No comments:
Post a Comment