Class: Monban::UseCase::Auth::Token::Full

Inherits:
Base
  • Object
show all
Includes:
Helper
Defined in:
lib/monban/use_case/auth/token/full.rb

Instance Method Summary collapse

Instance Method Details

#create(params) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/monban/use_case/auth/token/full.rb', line 32

def create(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
    auth.full(
      public_id:  generate_public_id!(account_id: params[:account_id]),
      roles:      repository.roles(account_id: params[:account_id]),
      expired_at: time.now + expire,
    )
  end
end