Sha256: a6c7e631c52feac3b3b269e9013c8eb9a20b861d475396028493a40e6693ce02
Contents?: true
Size: 935 Bytes
Versions: 7
Compression:
Stored size: 935 Bytes
Contents
require "monban/core" require "monban/use_case/base" require "getto/params" module Monban module UseCase module Account class Unregister < Base initialize_with( error: Monban::Core::ERRORS, repository: [ :transaction, :account_exists?, :delete_account, ], ) def unregister(params) Getto::Params.new.validate(params) do |v| v.hash( account_id: v.integer{|val| param_error!(account_id: val) }, ) end or param_error!(params: params) repository.transaction do unless repository.account_exists?(account_id: params[:account_id]) error.not_found! "account_id: #{params[:account_id]}" end repository.delete_account(account_id: params[:account_id]) end nil end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems