Change Tokens to ApiKey

Added name to ApiKey model
This commit is contained in:
Rebecca Law
2016-01-19 12:07:00 +00:00
parent 6966c2484f
commit 4fc5c34320
14 changed files with 281 additions and 226 deletions

View File

@@ -1,6 +1,5 @@
from . import ma
from . import models
from marshmallow import post_load
# TODO I think marshmallow provides a better integration and error handling.
# Would be better to replace functionality in dao with the marshmallow supported
@@ -19,7 +18,7 @@ class UserSchema(ma.ModelSchema):
class ServiceSchema(ma.ModelSchema):
class Meta:
model = models.Service
exclude = ("updated_at", "created_at", "tokens", "templates", "jobs")
exclude = ("updated_at", "created_at", "api_key", "templates", "jobs")
class TemplateSchema(ma.ModelSchema):
@@ -28,9 +27,9 @@ class TemplateSchema(ma.ModelSchema):
exclude = ("updated_at", "created_at", "service_id", "jobs")
class TokenSchema(ma.ModelSchema):
class ApiKeySchema(ma.ModelSchema):
class Meta:
model = models.Token
model = models.ApiKey
exclude = ["service"]
@@ -45,7 +44,7 @@ service_schema = ServiceSchema()
services_schema = ServiceSchema(many=True)
template_schema = TemplateSchema()
templates_schema = TemplateSchema(many=True)
token_schema = TokenSchema()
tokens_schema = TokenSchema(many=True)
api_key_schema = ApiKeySchema()
api_keys_schema = ApiKeySchema(many=True)
job_schema = JobSchema()
jobs_schema = JobSchema(many=True)