Last active
August 25, 2020 19:00
-
-
Save serradura/eb0dbf5ff1832a3773278a342735e714 to your computer and use it in GitHub Desktop.
u-case ideas - Skip e Chech
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 ContractTemplates | |
module Update | |
class TryCreateRevision < Micro::Case | |
attributes :company, :params | |
def call! | |
return Success(:skipped_contract_revision) unless term_changed? | |
ContractRevision.create!(contract_revision_params) | |
Success(:contract_revision_was_created) | |
end | |
private | |
def term_changed?; end | |
def contract_revision_params; end | |
end | |
end | |
end | |
# -- | |
module ContractTemplates | |
module Update | |
class TryCreateRevision < Micro::Case | |
attributes :company, :params | |
def call! | |
Skip if: !term_changed?, or: apply(:create_contract_revision) | |
end | |
private | |
def term_changed?; end | |
def contract_revision_params; end | |
def create_contract_revision | |
ContractRevision.create!(contract_revision_params) | |
Success(:contract_revision_was_created) | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Check
Try