Last active
June 10, 2018 06:39
-
-
Save joegaudet/38633aba95e633edd67e30d55deb8965 to your computer and use it in GitHub Desktop.
Every . b ut the last should be treated as a file system '/'
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ClientController | |
dependency :assign_user, Clients::AssignUser | |
def assign_user | |
assign_user.(params[:user_id], params[:client_id]) | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Application | |
module Clients | |
class AssignUser | |
dependency :get_user, Application::Users::Queries::Get | |
dependency :get_client, Application::Users::Queries::Get | |
def call(user_id, client_id) | |
user = get_user.(user_id) | |
client = get_client.(client_id) | |
client.admins << user | |
client.save! | |
client | |
end | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Application | |
module Clients | |
module Queries | |
class Get | |
dependency :client, Client | |
def call(id) | |
client.find(id) | |
end | |
end | |
end | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Application | |
module Users | |
module Queries | |
class Get | |
dependency :user, User | |
def call(id) | |
user.find(id) | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment