Class: AppOwnerController

Inherits:
ApplicationController show all
Defined in:
app/controllers/app_owner_controller.rb

Instance Method Summary collapse

Methods included from AuthentificationHelper

#accessible_company_ids_from_tenant_and_user, #application_mode_from_hostname, #current_company_id_from_accessible_company_ids, #current_tenant_from_user, #current_user_and_locale_from_token

Instance Method Details

#create_or_updateObject



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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'app/controllers/app_owner_controller.rb', line 22

def create_or_update
  app_owner_id = params[:app_owner_id]
  record_type = params[:record_type]
  company_name = params[:company_name]
  address_1 = params[:address_1]
  address_2 = params[:address_2]
  city = params[:city]
  postal_code = params[:postal_code]
  province_id = params[:province_id]
  attention = params[:attention]
  email = params[:email]
  phone = params[:phone]
  website_url = params[:website_url]
  gst_no = params[:gst_no]
  hst_no = params[:hst_no]
  pst_no = params[:pst_no]
  logo_path = params[:logo_path]

  AppOwner.insert_update_app_owner_procedure(
    app_owner_id: app_owner_id,
    record_type: record_type,
    company_name: company_name,
    address_1: address_1,
    address_2: address_2,
    city: city,
    postal_code: postal_code,
    province_id: province_id,
    attention: attention,
    email: email,
    phone: phone,
    website_url: website_url,
    gst_no: gst_no,
    hst_no: hst_no,
    pst_no: pst_no,
    logo_path: logo_path
  )

  render json: {
    message: I18n.t('messages.changes_saved')
  }
end

#emptyObject



17
18
19
20
# File 'app/controllers/app_owner_controller.rb', line 17

def empty
  is_empty = AppOwner.count.zero?
  render json: is_empty
end

#indexObject



6
7
8
# File 'app/controllers/app_owner_controller.rb', line 6

def index
  render json: { message: 'App Owner Controller' }
end

#showObject



10
11
12
13
14
15
# File 'app/controllers/app_owner_controller.rb', line 10

def show
  app_owner_id = params[:id]
  record_type = ''
  result = AppOwner.find_procedure(app_owner_id, record_type)
  render json: result
end