trailsjs / trailpack-router

:package: Router. Aggregate and Configure Application Routes.
MIT License
12 stars 7 forks source link

Name of create policy is not consistant #55

Closed KNTH01 closed 8 years ago

KNTH01 commented 8 years ago

Hi,

When I create a Policy with yo : yo trails:policy Auth or yo trails:policy AuthPolicy, it's create me a file named api/policies/Auth.js with AuthPolicy class. In api/policies/index.js, I have exports.Auth = require('./Auth').

So to use my policy :

// config/policies.js
module.exports = {
  ExampleController: {
    test: [ 'Auth.test' ] // Should be AuthPolicy.test
  }
}

But in the example (readme.md) there is :

// config/policies.js
module.exports = {
  ExampleController: {
    test: [ 'ExamplePolicy.test' ]
  }
}

I find this is not consistent regarding to the controllers and services system which add Controller and Service prefix to the new generated controller or service. So when I generate a policy, I should have AuthPolicy.js instead of Auth.js isn't it ?

The same note applies to models too.

konstantinzolotarev commented 8 years ago

Bug related to https://github.com/trailsjs/generator-trails

KNTH01 commented 8 years ago

Ok, thanks. I am going to open it on this repository, and close this one :)

konstantinzolotarev commented 8 years ago

@KevinNTH Thank you very much !