-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor admin as a component (part of Issue 2490) #2492
base: master
Are you sure you want to change the base?
Conversation
Change app.js to seed database in promise chain before startServer, move seeding conditional to seed.js and wrap in function.
Previously, .sync() was being called once in server/config/seed.js and once during sqldb.sequelize.sync() in server/app.js. As a result, duplicate queries were being sent to the database if the tables needed to be defined causing an error when it tries to define constraints a second time (like for an identity column). Seed.js is wrapped in a function and contains the conditional to determine whether to seed the database. This makes it easy to include in the promise chain under sqldb.sequelize.sync().
Previously, .sync() was being called once in server/config/seed.js and once during sqldb.sequelize.sync() in server/app.js. As a result, duplicate queries were being sent to the database if the tables needed to be defined causing an error when it tries to define constraints a second time (like for an identity column). Seed.js is wrapped in a function and contains the conditional to determine whether to seed the database. This makes it easy to include in the promise chain under sqldb.sequelize.sync().
Previously, admin was implemented as a loosely coupled controller. Converting it to a full component makes it consistent with main and generated components.
For projects with auth=Y, users were not being populated for those using Sequelize because of the return on Think.bulkCreate. The return was changed to a Sequelize.Promise.all so that all the promises are properly managed.
I think you should use the same model as the main component, and have the admin controller class in the same |
Also, you'll need to pull your latest commit for |
I've added you as a collaborator, so you can make a branch directly on this repository if you'd like. |
Previously, admin was implemented as a loosely coupled controller. Converting it to a full component makes it consistent with main and generated components.
Thanks for adding me as a contributor. I pushed an additional commit that put the controller code back into admin.module.js. Also added the corrected seed(model).js. |
Did a git revert f6da78f to undo the changes to templates/app/server/config/seed(models).js. Please let me know if that was what you were looking for. |
generator-angular-fullstack$ npm test
)First modification towards 2490.. Wasn't sure whether this should go in canary or master. BTW, I found a problem in seed.js from my previous PR and will submit another to correct it.