Shift validations in Integrations::Base::Integration to models
Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.
The following discussion from !170439 (merged) should be addressed:
-
@.luke started a discussion: Thought
Once we've moved instance integrations out of the
integrations
table, it would be worth moving some of these validations out of the shared module and into the classes soIntegration
has different validations fromIntegrations::Instance::Integration
.For example,
Integrations::Instance::Integration
could validate thatinstance
is alwaystrue
, andproject_id
andgroup_id
are alwaysnil
.Integration
could validate thatinstance
is alwaysfalse
and thatproject_id
orgroup_id
are present, and so on.
There would be other things we can do too, like:
- Remove
Integrations::Base::Integration#instance_level?
and add a methodIntegration#instance_level?
which returnsfalse
inIntegration
. - Move
Integrations::Base::Integration#parent
toIntegration
and add a methodIntegrations::Instance::Integration#parent
which returnsnil
.