{"action":"created","issue":{"url":"https://api.github.com/repos/OpenTechStrategies/smoke-alarm-portal/issues/44","labels_url":"https://api.github.com/repos/OpenTechStrategies/smoke-alarm-portal/issues/44/labels{/name}","comments_url":"https://api.github.com/repos/OpenTechStrategies/smoke-alarm-portal/issues/44/comments","events_url":"https://api.github.com/repos/OpenTechStrategies/smoke-alarm-portal/issues/44/events","html_url":"https://github.com/OpenTechStrategies/smoke-alarm-portal/issues/44","id":93395218,"number":44,"title":"Add admin area to Red Cross site.","user":{"login":"trystant","id":13509,"avatar_url":"https://avatars.githubusercontent.com/u/13509?v=3","gravatar_id":"","url":"https://api.github.com/users/trystant","html_url":"https://github.com/trystant","followers_url":"https://api.github.com/users/trystant/followers","following_url":"https://api.github.com/users/trystant/following{/other_user}","gists_url":"https://api.github.com/users/trystant/gists{/gist_id}","starred_url":"https://api.github.com/users/trystant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trystant/subscriptions","organizations_url":"https://api.github.com/users/trystant/orgs","repos_url":"https://api.github.com/users/trystant/repos","events_url":"https://api.github.com/users/trystant/events{/privacy}","received_events_url":"https://api.github.com/users/trystant/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"trystant","id":13509,"avatar_url":"https://avatars.githubusercontent.com/u/13509?v=3","gravatar_id":"","url":"https://api.github.com/users/trystant","html_url":"https://github.com/trystant","followers_url":"https://api.github.com/users/trystant/followers","following_url":"https://api.github.com/users/trystant/following{/other_user}","gists_url":"https://api.github.com/users/trystant/gists{/gist_id}","starred_url":"https://api.github.com/users/trystant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trystant/subscriptions","organizations_url":"https://api.github.com/users/trystant/orgs","repos_url":"https://api.github.com/users/trystant/repos","events_url":"https://api.github.com/users/trystant/events{/privacy}","received_events_url":"https://api.github.com/users/trystant/received_events","type":"User","site_admin":false},"milestone":null,"comments":1,"created_at":"2015-07-06T22:48:54Z","updated_at":"2015-07-09T14:23:20Z","closed_at":null,"body":"The administrative area will add the ability to have a distinct area that only admins can access, as well as an area that grants a simple reporting feature for requests that have been entered. \r\n\r\nMy initial desire was to integrate a version of [Drywall](https://github.com/trystant/drywall) user and admin system for Node that uses [Sequelize](http://sequelize.readthedocs.org/en/latest/) to connect to Postgres, which we are using now.\r\n\r\nI forked a fork that had been started, but was configured to use ES6 (\"Harmony\").\r\n\r\nI believe that it will take me 6 - 8 hours to:\r\n\r\n* Replace the ES6 compatible code with current JS code.\r\n* Remove unneeded code in order to implement the admin and user functionality.\r\n* Integrate this into the current application\r\n* Provide documentation for the reasons behind implementing this as well as installation\r\n\r\n@kfogel, @cecilia-donnelly - Please let me know your thoughts. Thanks."},"comment":{"url":"https://api.github.com/repos/OpenTechStrategies/smoke-alarm-portal/issues/comments/119999854","html_url":"https://github.com/OpenTechStrategies/smoke-alarm-portal/issues/44#issuecomment-119999854","issue_url":"https://api.github.com/repos/OpenTechStrategies/smoke-alarm-portal/issues/44","id":119999854,"user":{"login":"trystant","id":13509,"avatar_url":"https://avatars.githubusercontent.com/u/13509?v=3","gravatar_id":"","url":"https://api.github.com/users/trystant","html_url":"https://github.com/trystant","followers_url":"https://api.github.com/users/trystant/followers","following_url":"https://api.github.com/users/trystant/following{/other_user}","gists_url":"https://api.github.com/users/trystant/gists{/gist_id}","starred_url":"https://api.github.com/users/trystant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/trystant/subscriptions","organizations_url":"https://api.github.com/users/trystant/orgs","repos_url":"https://api.github.com/users/trystant/repos","events_url":"https://api.github.com/users/trystant/events{/privacy}","received_events_url":"https://api.github.com/users/trystant/received_events","type":"User","site_admin":false},"created_at":"2015-07-09T14:23:20Z","updated_at":"2015-07-09T14:23:20Z","body":"The general code has been added to the repo under the drywall_integration branch. If you start the app in this branch, youSuccessive commits show the pieces of drywall (heh) that have been added to the repository. I've been stuck on replicating the drywall user administration process shown [here](https://github.com/jedireza/drywall#setup) in a Sequelize migration, a process that has turned out to have some challenges associated with it. For example; doing sequential SQL inserts becomes a challenge in a Promise based library. The migration code that I have currently has the Promise/callback pyramid hell, which is shown below:\r\n\r\n````\r\n db.AdminGroup.create({ name: 'Root' }).then(function(adminGroup) {\r\n      db.Admin.create({ name: 'Root Admin'}).then(function(admin) {\r\n        admin.setAdminGroup(adminGroup);\r\n        admin.save();\r\n        db.User.create({ username: 'root', isActive: 'yes', email: 'mark@grandkru.com'}).then(function(user) {\r\n          user.setAdmin(admin);\r\n          user.save();\r\n        });\r\n      });\r\n    });\r\n\r\nEven this code doesn't completely create the users needed to go to the next stage of setup and use the \"Forgot Password\" functionality to create an initial user (which in and of itself could use improvement).\r\n\r\nOnce this piece is in place, the remaining steps for this would include:\r\n1. Verifying login/password functionality on the integrated instances\r\n2. Verifying grunt tasks to generate uglified css work for both the app and the admin\r\n\r\nI've spent six hours on this so far. I think that there may be more work ahead due to:\r\n* User role functions in the mongoose version not being fully implemented in the sequelize version\r\n\r\nMy next commit will connect app functionality so that the admin pages come up, even if there's not a user as of yet."}}