6
6
# bitbucket_workspace :string
7
7
# bugsnag_android_config :jsonb
8
8
# bugsnag_ios_config :jsonb
9
- # ci_cd_workflows :jsonb
10
9
# code_repository :json
11
10
# firebase_android_config :jsonb
12
11
# firebase_ios_config :jsonb
13
12
# jira_config :jsonb not null
14
- # notification_channel :json
15
13
# created_at :datetime not null
16
14
# updated_at :datetime not null
17
15
# app_id :uuid not null, indexed
@@ -22,7 +20,7 @@ class AppConfig < ApplicationRecord
22
20
include AppConfigurable
23
21
24
22
PLATFORM_AWARE_CONFIG_SCHEMA = Rails . root . join ( "config/schema/platform_aware_integration_config.json" )
25
- self . ignored_columns += %w[ bugsnag_project_id firebase_crashlytics_android_config firebase_crashlytics_ios_config notification_channel ]
23
+ self . ignored_columns += %w[ bugsnag_project_id firebase_crashlytics_android_config firebase_crashlytics_ios_config notification_channel ci_cd_workflows ]
26
24
27
25
belongs_to :app
28
26
has_many :variants , class_name : "AppVariant" , dependent : :destroy
@@ -47,28 +45,27 @@ def ready?
47
45
end
48
46
49
47
def code_repository_name
50
- return if code_repository . blank?
51
- code_repository [ "full_name" ]
48
+ code_repository &.fetch ( "full_name" , nil )
52
49
end
53
50
54
51
def code_repo_url
55
- code_repository [ "repo_url" ]
52
+ code_repository &. fetch ( "repo_url" , nil )
56
53
end
57
54
58
55
def code_repo_namespace
59
- code_repository [ "namespace" ]
56
+ code_repository &. fetch ( "namespace" , nil )
60
57
end
61
58
62
59
def code_repo_name_only
63
- code_repository [ "name" ]
60
+ code_repository &. fetch ( "name" , nil )
64
61
end
65
62
66
63
def bitrise_project
67
64
bitrise_project_id &.fetch ( "id" , nil )
68
65
end
69
66
70
67
def further_setup_by_category?
71
- integrations = app . integrations
68
+ integrations = app . integrations . connected
72
69
categories = { } . with_indifferent_access
73
70
74
71
if integrations . version_control . present?
@@ -131,10 +128,14 @@ def ci_cd_workflows
131
128
super &.map ( &:with_indifferent_access )
132
129
end
133
130
134
- def set_ci_cd_workflows ( workflows )
135
- return if code_repository . nil?
136
- return if app . ci_cd_provider . blank?
137
- update ( ci_cd_workflows : workflows )
131
+ def disconnect! ( integration )
132
+ if integration . version_control?
133
+ self . code_repository = nil
134
+ elsif integration . ci_cd?
135
+ self . bitrise_project_id = nil
136
+ end
137
+
138
+ save!
138
139
end
139
140
140
141
private
0 commit comments