adonisjs / auth

Official Authentication package for AdonisJS
https://docs.adonisjs.com/guides/auth/introduction
MIT License
187 stars 65 forks source link

Model name should start with capital letter when setup the auth #204

Closed 3adel-bassiony closed 1 year ago

3adel-bassiony commented 1 year ago

When I set up the authentication and run this command: node ace configure @adonisjs/auth it asked me to enter the model name and I entered user not User so it created the model called user, and later I thought it was an issue so I renamed it to User but the git didn't notice the case sensitive change so on my local is User but on GitHub is user

I fixed it by renaming it to the correct one User

I think when setup the auth it should be following the naming convention even if the user entered it with a small case, something like when creating a new model using this command line: node ace make:model user => It will create a new model called User not user

Originally posted by @3adel-bassiony in https://github.com/adonisjs/core/discussions/3861#discussioncomment-3393509

RomainLanz commented 1 year ago

Hey @3adel-bassiony! 👋🏻

In my opinion, this is not an issue at all. You may want to have your file naming convention all lowercase. We don't want to enforce that rules.

The issue you encountered was using a non-case-sensitive OS while developing and deploying on a case-sensitive OS.

3adel-bassiony commented 1 year ago

Hello @RomainLanz

Yes, the main issue was related to a case-sensitive, but if I created a new model using node ace it will create it with the first later Capital, so why I will need it with a small case? I think all models should follow the same naming convention right? Let's say I have other models Like ( Category - Post - Comment - etc. ) why I will need the user to be user not User like the other models?

thetutlage commented 1 year ago

Which part of the systems is enforcing you to use user and not User?

3adel-bassiony commented 1 year ago

When I create the model using node ace make:model user it will generate a new model with the first capital letter User, not user, and any other new model I will create will follow the same naming convention, so when I set up the auth it should follow the same naming convention right?

Why I will create all models with the same naming convention that start with a capital letter and when I set up the auth it will be a small letter? Maybe you can make it as the node ace make:model and if anyone wants to change the naming convention he can, I think most of people will follow the same naming convention, Actually I can enter it User when I set up the auth but maybe many people type it user by wrong because they thought it will be like creating any new model it will change to User not user and that's what happened with me

thetutlage commented 1 year ago

so when I set up the auth it should follow the same naming convention right?

Okay got it. So basically the node ace configure @adonisjs/auth is not capitalising the model name, whereas the make:model command does.

3adel-bassiony commented 1 year ago

Yes exactly 👍