2020-06-23 00:09:42 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
module HasIntegrations
|
2020-06-23 00:09:42 +05:30
|
|
|
extend ActiveSupport::Concern
|
|
|
|
|
|
|
|
class_methods do
|
2021-01-03 14:25:43 +05:30
|
|
|
def without_integration(integration)
|
2021-06-08 01:23:25 +05:30
|
|
|
integrations = Integration
|
2020-07-28 23:09:34 +05:30
|
|
|
.select('1')
|
2021-09-30 23:02:18 +05:30
|
|
|
.where("#{Integration.table_name}.project_id = projects.id")
|
2020-07-28 23:09:34 +05:30
|
|
|
.where(type: integration.type)
|
|
|
|
|
|
|
|
Project
|
2021-06-08 01:23:25 +05:30
|
|
|
.where('NOT EXISTS (?)', integrations)
|
2020-07-28 23:09:34 +05:30
|
|
|
.where(pending_delete: false)
|
|
|
|
.where(archived: false)
|
|
|
|
end
|
2020-06-23 00:09:42 +05:30
|
|
|
end
|
|
|
|
end
|