@@ -15,6 +15,7 @@ class Project < ApplicationRecord
1515 has_many :check_in_monitors , dependent : :destroy
1616 has_many :project_memberships , dependent : :destroy
1717 has_many :project_notification_preferences , dependent : :destroy
18+ has_many :integration_settings , class_name : "ProjectIntegrationSetting" , dependent : :destroy
1819 has_many :email_notification_deliveries , dependent : :destroy
1920 has_one :retention_policy , class_name : "ProjectRetentionPolicy" , dependent : :destroy
2021 has_many :telemetry_archives , dependent : :destroy
@@ -23,12 +24,17 @@ class Project < ApplicationRecord
2324 before_validation :ensure_uuid
2425 before_validation :normalize_slug
2526
27+ validate :integration_kind_cannot_change , on : :update
28+
2629 enum :integration_kind , {
2730 ruby : "ruby" ,
2831 cfml : "cfml" ,
2932 javascript : "javascript" ,
3033 python : "python" ,
3134 dotnet : "dotnet" ,
35+ cloudflare_pages : "cloudflare_pages" ,
36+ android : "android" ,
37+ ios : "ios" ,
3238 http_api : "http_api"
3339 } , default : :ruby , validate : true , prefix : :integration
3440
@@ -111,6 +117,9 @@ def integration_label
111117 "javascript" => "JavaScript / TypeScript" ,
112118 "python" => "Python" ,
113119 "dotnet" => ".NET / ASP.NET Core" ,
120+ "cloudflare_pages" => "Cloudflare Pages" ,
121+ "android" => "Android app" ,
122+ "ios" => "iOS app" ,
114123 "http_api" => "Manual / HTTP API"
115124 } . fetch ( integration_kind , integration_kind . to_s . humanize )
116125 end
@@ -130,6 +139,9 @@ def public_api_auth_failure_rate_limit_requests_effective(default)
130139 def self . integration_options
131140 [
132141 [ "Manual / HTTP API (custom client)" , "http_api" ] ,
142+ [ "Cloudflare Pages" , "cloudflare_pages" ] ,
143+ [ "Android app (logister-android)" , "android" ] ,
144+ [ "iOS app (logister-ios)" , "ios" ] ,
133145 [ "Ruby gem" , "ruby" ] ,
134146 [ ".NET / ASP.NET Core (logister-dotnet)" , "dotnet" ] ,
135147 [ "JavaScript / TypeScript (logister-js)" , "javascript" ] ,
@@ -241,4 +253,10 @@ def normalize_slug
241253 base = slug . presence || name
242254 self . slug = base . to_s . parameterize
243255 end
256+
257+ def integration_kind_cannot_change
258+ return unless will_save_change_to_integration_kind?
259+
260+ errors . add ( :integration_kind , "cannot be changed after project creation" )
261+ end
244262end
0 commit comments