Changes to node_schema
Now we use ObjectId for the user field and media for the picture field (previously known as thumbnail).
This commit is contained in:
parent
1b85823f9b
commit
39544e96da
@ -77,7 +77,7 @@ class TokensAuth(TokenAuth):
|
||||
token_data = {
|
||||
'user': user_id,
|
||||
'token': token,
|
||||
'expire_time': datetime.now()+timedelta(hours=1)
|
||||
'expire_time': datetime.now() + timedelta(hours=1)
|
||||
}
|
||||
post_internal('tokens', token_data)
|
||||
else:
|
||||
@ -101,7 +101,7 @@ class BasicsAuth(BasicAuth):
|
||||
return True
|
||||
|
||||
|
||||
class MyTokenAuth(BasicsAuth):
|
||||
class CustomTokenAuth(BasicsAuth):
|
||||
"""Switch between Basic and Token auth"""
|
||||
def __init__(self):
|
||||
self.token_auth = TokensAuth()
|
||||
@ -140,4 +140,4 @@ def post_item(entry, data):
|
||||
post_internal(entry, data)
|
||||
|
||||
|
||||
app = Eve(validator=ValidateCustomFields, auth=MyTokenAuth)
|
||||
app = Eve(validator=ValidateCustomFields, auth=CustomTokenAuth)
|
||||
|
@ -127,7 +127,7 @@ def populate_db_test():
|
||||
shot = {
|
||||
"name": "01",
|
||||
"description": "A sheep tries to hang itself, but fails",
|
||||
"thumbnail": "/tmp/attrackt-thumbnail.png",
|
||||
"picture": "",
|
||||
"order": 0,
|
||||
"parent": None,
|
||||
"node_type": "55016a52135d32466fc800be",
|
||||
|
@ -30,18 +30,7 @@ users_schema = {
|
||||
'type': 'list',
|
||||
'allowed': ["admin"],
|
||||
'required': True,
|
||||
},
|
||||
# An embedded 'strongly-typed' dictionary.
|
||||
'location': {
|
||||
'type': 'dict',
|
||||
'schema': {
|
||||
'address': {'type': 'string'},
|
||||
'city': {'type': 'string'}
|
||||
}
|
||||
},
|
||||
'born': {
|
||||
'type': 'datetime',
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
nodes_schema = {
|
||||
@ -56,10 +45,8 @@ nodes_schema = {
|
||||
'minlength': 0,
|
||||
'maxlength': 128,
|
||||
},
|
||||
'thumbnail': {
|
||||
'type': 'string',
|
||||
'minlength': 0,
|
||||
'maxlength': 128,
|
||||
'picture': {
|
||||
'type': 'media'
|
||||
},
|
||||
'order': {
|
||||
'type': 'integer',
|
||||
@ -74,7 +61,7 @@ nodes_schema = {
|
||||
#},
|
||||
},
|
||||
'user': {
|
||||
'type': 'string',
|
||||
'type': 'objectid',
|
||||
'required': True,
|
||||
},
|
||||
'node_type': {
|
||||
@ -92,7 +79,6 @@ nodes_schema = {
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
node_types_schema = {
|
||||
'name': {
|
||||
'type': 'string',
|
||||
@ -110,7 +96,6 @@ node_types_schema = {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
tokens_schema = {
|
||||
'user': {
|
||||
'type': 'objectid',
|
||||
@ -126,7 +111,6 @@ tokens_schema = {
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
nodes = {
|
||||
# We choose to override global cache-control directives for this resource.
|
||||
'cache_control': 'max-age=10,must-revalidate',
|
||||
@ -135,13 +119,11 @@ nodes = {
|
||||
'schema': nodes_schema
|
||||
}
|
||||
|
||||
|
||||
node_types = {
|
||||
'resource_methods': ['GET', 'POST'],
|
||||
'schema': node_types_schema,
|
||||
}
|
||||
|
||||
|
||||
users = {
|
||||
'item_title': 'user',
|
||||
|
||||
@ -159,7 +141,7 @@ users = {
|
||||
}
|
||||
|
||||
tokens = {
|
||||
'resource_methods': ['POST'],
|
||||
'resource_methods': ['GET', 'POST'],
|
||||
|
||||
# Allow 'token' to be returned with POST responses
|
||||
#'extra_response_fields': ['token'],
|
||||
|
Loading…
x
Reference in New Issue
Block a user