lib/hapiCrudHelper.js
function addConstraintsForForeignKeys (bookshelfModel, baseQuery) {
  if (typeof baseQuery === 'undefined') {
    return
  }
  
  _.forEach(baseQuery({params: {}, payload: {}}), function(v, k) {
    const value = bookshelfModel.prototype.schema[k]
    if (typeof value === 'undefined') {
      bookshelfModel.prototype.schema[k] = Joi.any().required()
    }
    else if (value.isJoi) {
      bookshelfModel.prototype.schema[k] = bookshelfModel.prototype.schema[k].required()
    }
  })
}
function addConstraintsForForeignKeys (bookshelfModel, baseQuery) {
  if (typeof baseQuery === 'undefined') {
    return
  }
  
  _.forEach(baseQuery({params: {}, payload: {}}), function(v, k) {
    const value = bookshelfModel.prototype.schema[k]
    if (typeof value === 'undefined') {
      bookshelfModel.prototype.schema[k] = Joi.any().required()
    }
    else if (value.isJoi) {
      bookshelfModel.prototype.schema[k] = bookshelfModel.prototype.schema[k].required()
    }
  })
}
function addConstraintsForForeignKeys ( bookshelfModel , baseQuery ) { if ( typeof baseQuery === 'undefined' ) { return } _ . forEach ( baseQuery ( { params : { } , payload : { } } ) , function ( v , k ) { const value = bookshelfModel . prototype . schema [ k ] if ( typeof value === 'undefined' ) { bookshelfModel . prototype . schema [ k ] = Joi . any ( ) . required ( ) } else if ( value . isJoi ) { bookshelfModel . prototype . schema [ k ] = bookshelfModel . prototype . schema [ k ] . required ( ) } } ) }
Adds required() validation constraints to all the bookshelfModel's foreign keys, as defined in baseQuery.
Adds required () validation constraints to all the bookshelfModel s foreign keys as defined in baseQuery .