mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-05 10:42:41 -05:00
reformat
This commit is contained in:
@@ -38,23 +38,23 @@ def ignore_first_argument_cache_key(cls, *args, **kwargs):
|
||||
|
||||
class SerialisedTemplate(SerialisedModel):
|
||||
ALLOWED_PROPERTIES = {
|
||||
'archived',
|
||||
'content',
|
||||
'id',
|
||||
'process_type',
|
||||
'reply_to_text',
|
||||
'subject',
|
||||
'template_type',
|
||||
'version',
|
||||
"archived",
|
||||
"content",
|
||||
"id",
|
||||
"process_type",
|
||||
"reply_to_text",
|
||||
"subject",
|
||||
"template_type",
|
||||
"version",
|
||||
}
|
||||
|
||||
@classmethod
|
||||
@memory_cache
|
||||
def from_id_and_service_id(cls, template_id, service_id, version=None):
|
||||
return cls(cls.get_dict(template_id, service_id, version)['data'])
|
||||
return cls(cls.get_dict(template_id, service_id, version)["data"])
|
||||
|
||||
@staticmethod
|
||||
@redis_cache.set('service-{service_id}-template-{template_id}-version-{version}')
|
||||
@redis_cache.set("service-{service_id}-template-{template_id}-version-{version}")
|
||||
def get_dict(template_id, service_id, version):
|
||||
from app.dao import templates_dao
|
||||
from app.schemas import template_schema
|
||||
@@ -68,38 +68,38 @@ class SerialisedTemplate(SerialisedModel):
|
||||
template_dict = template_schema.dump(fetched_template)
|
||||
db.session.commit()
|
||||
|
||||
return {'data': template_dict}
|
||||
return {"data": template_dict}
|
||||
|
||||
|
||||
class SerialisedService(SerialisedModel):
|
||||
ALLOWED_PROPERTIES = {
|
||||
'id',
|
||||
'name',
|
||||
'active',
|
||||
'contact_link',
|
||||
'email_from',
|
||||
'message_limit',
|
||||
'permissions',
|
||||
'rate_limit',
|
||||
'restricted',
|
||||
'prefix_sms',
|
||||
'email_branding'
|
||||
"id",
|
||||
"name",
|
||||
"active",
|
||||
"contact_link",
|
||||
"email_from",
|
||||
"message_limit",
|
||||
"permissions",
|
||||
"rate_limit",
|
||||
"restricted",
|
||||
"prefix_sms",
|
||||
"email_branding",
|
||||
}
|
||||
|
||||
@classmethod
|
||||
@memory_cache
|
||||
def from_id(cls, service_id):
|
||||
return cls(cls.get_dict(service_id)['data'])
|
||||
return cls(cls.get_dict(service_id)["data"])
|
||||
|
||||
@staticmethod
|
||||
@redis_cache.set('service-{service_id}')
|
||||
@redis_cache.set("service-{service_id}")
|
||||
def get_dict(service_id):
|
||||
from app.schemas import service_schema
|
||||
|
||||
service_dict = service_schema.dump(dao_fetch_service_by_id(service_id))
|
||||
db.session.commit()
|
||||
|
||||
return {'data': service_dict}
|
||||
return {"data": service_dict}
|
||||
|
||||
@cached_property
|
||||
def api_keys(self):
|
||||
@@ -107,15 +107,15 @@ class SerialisedService(SerialisedModel):
|
||||
|
||||
@property
|
||||
def high_volume(self):
|
||||
return self.id in current_app.config['HIGH_VOLUME_SERVICE']
|
||||
return self.id in current_app.config["HIGH_VOLUME_SERVICE"]
|
||||
|
||||
|
||||
class SerialisedAPIKey(SerialisedModel):
|
||||
ALLOWED_PROPERTIES = {
|
||||
'id',
|
||||
'secret',
|
||||
'expiry_date',
|
||||
'key_type',
|
||||
"id",
|
||||
"secret",
|
||||
"expiry_date",
|
||||
"key_type",
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user