move available provider logic to the service model

make sure it's in an accessible place so we don't end up duplicating our
work
This commit is contained in:
Leo Hemsted
2020-12-03 17:44:32 +00:00
parent 72f8a15d4f
commit fd335e3d8b
2 changed files with 12 additions and 21 deletions

View File

@@ -541,6 +541,13 @@ class Service(db.Model, Versioned):
'research_mode': self.research_mode
}
def get_available_broadcast_providers(self):
# There may be future checks here if we add, for example, platform admin level provider killswitches.
if self.allowed_broadcast_provider:
return [x for x in current_app.config['ENABLED_CBCS'] if x == self.allowed_broadcast_provider]
else:
return current_app.config['ENABLED_CBCS']
class AnnualBilling(db.Model):
__tablename__ = "annual_billing"