Open dennishall1 opened 8 years ago
Tidy! Want to make a PR for discussion in context?
(lots of this code is not minimal, because it's trying to make space to show user-defined code hanging off of the structure, but some of it is pretty meaningless)
I may get around to making a PR for it. To me, what's slightly confusing about the AdminModel and IndexModel .. they probably shouldn't be models, but instances of a PageModel (doesn't exist yet). Or at least, use the word page in the model name when referring to a page model, to help disambiguate. (UserModel is not a model for the /user page, there is no such page, but AdminModel is a model for the Admin page, and not a model of an Admin-kind-of-user.)
I might suggest using "view" instead of "page" but agree with the general thrust of your comment.
The AdminModel appears to be meaningless indirection. I removed it, and I also removed the unused reference to
auth
that is incontrollers/index.js
.My
controllers/index.js
file now looks like this (notice that /admin simply uses profilemodel, because the admin is just a user who happens to have a role of admin):