四好公路
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

20 lines
675 B

'use strict';
module.exports = function(Resource, resource, association) {
// access points
var subResourceName =
association.target.options.name.singular.toLowerCase();
var associatedResource = new Resource({
app: resource.app,
sequelize: resource.sequelize,
model: association.target,
endpoints: [resource.endpoints.plural + '/:' + association.identifierField + '/' + subResourceName],
actions: ['read'],
});
// @todo: this could be improved
associatedResource.associationOptions = resource.associationOptions;
associatedResource.controllers.read.includeAttributes = [ association.identifierField ];
return associatedResource;
};