Class: UffizziCore::Api::Cli::V1::Ci::SessionsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/uffizzi_core/api/cli/v1/ci/sessions_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject

Create session



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'app/controllers/uffizzi_core/api/cli/v1/ci/sessions_controller.rb', line 15

def create
  return render json: { errors: { title: [I18n.t('session.unsupported_login_type')] } }, status: :unprocessable_entity unless ci_session

  session_data, errors = ci_session.session_data_from_ci(user_params)
  return render json: { errors: errors }, status: :unprocessable_entity if errors.present?

  (session_data[:user])

  data = {
    account_id: session_data[:account_id],
    project_slug: session_data[:project_slug],
  }

  render json: data, status: :created
end