2020-06-02 08:08:33 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2021-05-12 08:10:24 -04:00
|
|
|
module HasIntegrations
|
2020-06-02 08:08:33 -04:00
|
|
|
extend ActiveSupport::Concern
|
|
|
|
|
|
|
|
class_methods do
|
2020-09-29 11:10:08 -04:00
|
|
|
def without_integration(integration)
|
2021-05-12 08:10:24 -04:00
|
|
|
integrations = Integration
|
2020-06-23 14:09:28 -04:00
|
|
|
.select('1')
|
2021-07-07 11:07:24 -04:00
|
|
|
.where("#{Integration.table_name}.project_id = projects.id")
|
2020-06-23 14:09:28 -04:00
|
|
|
.where(type: integration.type)
|
|
|
|
|
|
|
|
Project
|
2021-05-12 08:10:24 -04:00
|
|
|
.where('NOT EXISTS (?)', integrations)
|
2020-06-23 14:09:28 -04:00
|
|
|
.where(pending_delete: false)
|
|
|
|
.where(archived: false)
|
|
|
|
end
|
2020-06-02 08:08:33 -04:00
|
|
|
end
|
|
|
|
end
|