-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add collaborators #127
Add collaborators #127
Conversation
Includes a few additional imporvements * Collaborators join table added. * Collaborators hooked up on the frontend. Avaliable collaborators depends on the report's region (hardcoded to 1 for now) * Activity report checks permissions * Added the first "policies" which can be used for authorization. Should be easier to test separated from controllers * Route tests that hit the DB moved to the services folder, only deal with the DB ineractions * Route tests mock out DB and authorization calls focusing on constructing correct responses based on (mocked) calls to the DB/policies * Multiselect sets null values to an empty array, allowing collaborators/recipients to be "zeroed" in the report * Approvers are scoped to region * The activity report now makes all API calls up front in parallel. Should keep other components simpler and cuts down on calls to the API (they can be made once instead on every form page load) * Added Krys and I to seeders as Admins so we should be admins in sandbox/dev until HSES resets again. (can add others to the seeders but we were the only two who currently have accounts on sandbox, so the only two I know HSES ids)
Conflicts: .circleci/config.yml frontend/src/pages/ActivityReport/Pages/ReviewSubmit.js frontend/src/pages/ActivityReport/Pages/__tests__/ReviewSubmit.js frontend/src/pages/ActivityReport/Pages/index.js frontend/src/pages/ActivityReport/index.js src/services/activityReports.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this looks great so far. I noticed a lot of cleanup/refactoring that makes things easier to understand, along with the improvements you were creating. Nice work!
I don't think I have a login for the sandbox yet, so I will be in touch about getting set up there.
Here's the feedback I have at this time. I saw a few minor typos; one was breaking the API docs for me. I also have feelings about using lodash (when es201x or even es5 should be able to handle most things), but I can see it is used throughout, so NBD.
Conflicts: src/models/activityReport.js src/routes/apiDirectory.js
Co-authored-by: Daniel Cloud <[email protected]>
Co-authored-by: Daniel Cloud <[email protected]>
…Start-TTADP into js-109-add-collaborators
hmm...I get the same message "Unable to load..." |
} | ||
|
||
isApprovingManager() { | ||
return this.activityReport.approvingManagerId === this.user.id; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For MVP there will only be one manager, but I wonder if designing for future expansion could be worth it at this point, e.g. include the manager in the collaborators table with a flag. That's just one way.
But, if you think this would add a lot of extra work for now, we can postpone.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That feels like something we can leave until after the MVP, especially because we aren't 100% sure how multiple managers are going to work at this point. I'd hate to start down a path now and have it turn out to be the wrong path. Should be easy to update this class once we add the ability for a report to have multiple managers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be easy to update this class once we add the ability for a report to have multiple managers.
Once we are in prod we are going to have to deal with the data migration as well.
Yeah I seem to have lost admin permissions on sandbox as well |
* Add unique indexes to Activity Recipient and collaborators join tables * Replace lodash functions in two places * collaborators and recipients are "upsert"ed instead of all removed and recreated * Add FIXME to comment
import _ from 'lodash'; | ||
import SCOPES from '../middleware/scopeConstants'; | ||
|
||
export default class ActivityReport { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
Migrations weren't running properly. It is now fixed and you should be able to create reports. All previously entered reports have were deleted. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! 👍
Note for the future - if there is time before the MVP launch to clarify how we are going to using multiple managers on the report, it might be worth refactoring the db schema to create a many to many relationship between ar(s) and managers, to avoid potential data migration in prod.
Conflicts: src/routes/files/handlers.test.js
Description of change
Includes a few additional improvements, got bigger because I refactored some tests to hopefully make them easier to deal with in the future.
How to test
Note
I still need to update API docs/DB docs
Issue(s)
Checklist