在Strongloop环回中覆盖Relation Remote方法

ido*_*mun 3 node.js strongloop loopbackjs

我有一个用户模型和一个跟随者模型,它跟随用户和跟随者的用户具有HasManyThrough关系.如何更改默认的__get__followers方法参数?

ido*_*mun 5

我发现我可以通过正常的方式添加一个新的远程方法.

loopback.remoteMethod(
            UserModel.prototype.getFollows,
            {
                description: 'Get the users who are followed by the user',
                accepts: [
                    {arg: 'page', type: 'Number', http: {source: 'query'}, required: true}
                ],
                returns: {arg: 'data', type: 'object'},
                http: {verb: 'get', path: '/follows'},
                isStatic: false,
            }
    );
Run Code Online (Sandbox Code Playgroud)