Class: Monban::UseCase::Account::Register

Inherits:
Base
  • Object
show all
Defined in:
lib/monban/use_case/account/register.rb

Instance Method Summary collapse

Instance Method Details

#create(params) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/monban/use_case/account/register.rb', line 22

def create(params)
  Getto::Params.new.validate(params) do |v|
    v.hash(
      login_id: v.combine([v.string, v.not_empty]){|val| param_error!(login_id: val) },
    )
  end or param_error!(params: params)

  repository.transaction do
    if repository.(login_id: params[:login_id])
      error.conflict! "login_id already exists"
    end

     = repository.(
      now: time.now,
    )

    repository.(
      account_id: ,
      login_id: params[:login_id],
      now:      time.now,
    )

    
  end
end