lib/patch.js
function hasOneRemoting (relationName, relation, define) {
  var pathName = (relation.options.http && relation.options.http.path) ||
    relationName
  var toModelName = relation.modelTo.modelName

  define('__get__' + relationName, {
    isStatic: false,
    accessType: 'READ',
    description: 'Fetches hasOne relation ' + relationName + '.',
    http: {
      verb: 'get',
      path: '/' + pathName
    },
    accepts: {
      arg: 'refresh',
      type: 'boolean',
      http: {
        source: 'query'
      }
    },
    returns: {
      arg: relationName,
      type: relation.modelTo.modelName,
      root: true
    }
  })

  var findHasOneRelationshipsFunc = function (cb) {
    this['__get__' + pathName](cb)
  }

  define(
    '__findRelationships__' + relationName,
    {
      isStatic: false,
      accessType: 'READ',
      description: 'Find relations for ' + relationName + '.',
      http: {
        verb: 'get',
        path: '/relationships/' + pathName
      },
      returns: {
        arg: 'result',
        type: toModelName,
        root: true
      }
    },
    findHasOneRelationshipsFunc
  )
}
function hasOneRemoting (relationName, relation, define) {
  var pathName = (relation.options.http && relation.options.http.path) ||
    relationName
  var toModelName = relation.modelTo.modelName

  define('__get__' + relationName, {
    isStatic: false,
    accessType: 'READ',
    description: 'Fetches hasOne relation ' + relationName + '.',
    http: {
      verb: 'get',
      path: '/' + pathName
    },
    accepts: {
      arg: 'refresh',
      type: 'boolean',
      http: {
        source: 'query'
      }
    },
    returns: {
      arg: relationName,
      type: relation.modelTo.modelName,
      root: true
    }
  })

  var findHasOneRelationshipsFunc = function (cb) {
    this['__get__' + pathName](cb)
  }

  define(
    '__findRelationships__' + relationName,
    {
      isStatic: false,
      accessType: 'READ',
      description: 'Find relations for ' + relationName + '.',
      http: {
        verb: 'get',
        path: '/relationships/' + pathName
      },
      returns: {
        arg: 'result',
        type: toModelName,
        root: true
      }
    },
    findHasOneRelationshipsFunc
  )
}
function hasOneRemoting ( relationName , relation , define ) { var pathName = ( relation . options . http && relation . options . http . path ) || relationName var toModelName = relation . modelTo . modelName define ( '__get__' + relationName , { isStatic : false , accessType : 'READ' , description : 'Fetches hasOne relation ' + relationName + '.' , http : { verb : 'get' , path : '/' + pathName } , accepts : { arg : 'refresh' , type : 'boolean' , http : { source : 'query' } } , returns : { arg : relationName , type : relation . modelTo . modelName , root : true } } ) var findHasOneRelationshipsFunc = function ( cb ) { this [ '__get__' + pathName ] ( cb ) } define ( '__findRelationships__' + relationName , { isStatic : false , accessType : 'READ' , description : 'Find relations for ' + relationName + '.' , http : { verb : 'get' , path : '/relationships/' + pathName } , returns : { arg : 'result' , type : toModelName , root : true } } , findHasOneRelationshipsFunc ) }
Defines has one remoting.
@public
@memberOf {Patch}
@param {String} relationName
@param {Object} relation
@param {Function} define
@return {undefined}
Defines has one remoting .