mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-18 05:28:49 -04:00
'detailed' flag on GET /service/<uuid>
if passed in, returns the service object with additional statistics dictionary, which will be used in the admin app to populate dashboard components. A new schema has been created for this to avoid clashing/ causing confusion with the existing schema, which is already used for PUT/POST as well, and this schema can be easily tailored to reduce ambiguity and lazy-loading
This commit is contained in:
@@ -123,6 +123,23 @@ class ServiceSchema(BaseSchema):
|
||||
raise ValidationError('Only alphanumeric characters allowed')
|
||||
|
||||
|
||||
class DetailedServiceSchema(BaseSchema):
|
||||
statistics = fields.Dict()
|
||||
|
||||
class Meta:
|
||||
model = models.Service
|
||||
exclude = (
|
||||
'api_keys',
|
||||
'templates',
|
||||
'users',
|
||||
'created_by',
|
||||
'jobs',
|
||||
'template_statistics',
|
||||
'service_provider_stats',
|
||||
'service_notification_stats'
|
||||
)
|
||||
|
||||
|
||||
class NotificationModelSchema(BaseSchema):
|
||||
class Meta:
|
||||
model = models.Notification
|
||||
@@ -486,6 +503,7 @@ user_schema = UserSchema()
|
||||
user_schema_load_json = UserSchema(load_json=True)
|
||||
service_schema = ServiceSchema()
|
||||
service_schema_load_json = ServiceSchema(load_json=True)
|
||||
detailed_service_schema = DetailedServiceSchema()
|
||||
template_schema = TemplateSchema()
|
||||
template_schema_load_json = TemplateSchema(load_json=True)
|
||||
api_key_schema = ApiKeySchema()
|
||||
|
||||
Reference in New Issue
Block a user