Skip to content
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

Issue 95: Interactors #108

Merged
merged 1 commit into from
Mar 25, 2017
Merged

Conversation

jconley88
Copy link
Contributor

@jconley88 jconley88 commented Mar 24, 2017

Overview

This is intended to address Issue #95

Details

  • Volunteers#knight
  • Volunteers#reactivate
  • ScheduleChains#update
  • ScheduleChains#take
  • ScheduleChains#leave
  • Logs#take
  • Logs#leave
  • Absences#create

@jconley88 jconley88 force-pushed the Issue95 branch 2 times, most recently from e6f5e8b to 7758e2a Compare March 24, 2017 15:48
@@ -222,8 +222,8 @@ def knight
end

volunteer = Volunteer.find(params[:volunteer_id])
Copy link
Contributor Author

@jconley88 jconley88 Mar 24, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left this find here in case we wanted to apply the pattern here and act on both a Volunteer and Assignment.

If not, I'll pull this down into Knight.

Copy link
Member

@ericfreese ericfreese Mar 24, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I think the difference between these is that this one makes the volunteer a "super admin" whereas the one in assignments_controller makes the volunteer a "region admin".

As far as authorization goes, there's basically 3 roles a user can be: super admin, region admin, or regular volunteer:

  • Volunteers are assigned to a region, and can only do certain things in that region.
  • Region admins can do everything a regular volunteer can do but can do more things than regular volunteers in the regions they are assigned to.
  • Super admins can do everything regular volunteers can do and everything region admins can do (for all regions), plus some other stuff.

What would you think of renaming this interactor to something like ToggleSuperAdmin? Then we could create a separate interactor for AssignmentsController#knight named something like ToggleRegionAdmin?

I think it's still fine to have it take an ActiveRecord object (Volunteer) instead of an id though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm down with that!

)
end

it 'sets the admin flad' do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small typo ;)

require 'rails_helper'

RSpec.describe Knight do
describe '::call' do
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does the "::" in "::call" indicate? Yeah, yeah, I know that I technically wrote this, haha.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That it's a class method, opposed to an instance method which would be #call.

Based on the notation in the docs: https://ruby-doc.org/core-2.2.0/Array.html

screenshot 2017-03-24 14 43 37

@jconley88
Copy link
Contributor Author

Feedback on style and naming for this project is welcome so I stay consistent with this app.

Copy link
Member

@ericfreese ericfreese left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@rylanb rylanb merged commit 13861b7 into boulder-food-rescue:master Mar 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants