Simplified settings by introducing _node_embedded_schema.

This follows the same style as the already-existing _file_embedded_schema.
This commit is contained in:
Sybren A. Stüvel 2016-07-19 12:33:42 +02:00
parent 3ddfbddf1a
commit fe148e1e6b

View File

@ -21,6 +21,15 @@ _file_embedded_schema = {
} }
} }
_node_embedded_schema = {
'type': 'objectid',
'data_relation': {
'resource': 'nodes',
'field': '_id',
'embeddable': True
}
}
_required_user_embedded_schema = { _required_user_embedded_schema = {
'type': 'objectid', 'type': 'objectid',
'required': True, 'required': True,
@ -147,15 +156,9 @@ organizations_schema = {
'type': 'string', 'type': 'string',
'maxlength': 256, 'maxlength': 256,
}, },
'picture': { 'picture': dict(
'type': 'objectid', nullable=True,
'nullable': True, **_file_embedded_schema),
'data_relation': {
'resource': 'files',
'field': '_id',
'embeddable': True
},
},
'users': { 'users': {
'type': 'list', 'type': 'list',
'default': [], 'default': [],
@ -271,14 +274,7 @@ nodes_schema = {
'description': { 'description': {
'type': 'string', 'type': 'string',
}, },
'picture': { 'picture': _file_embedded_schema,
'type': 'objectid',
'data_relation': {
'resource': 'files',
'field': '_id',
'embeddable': True
},
},
'order': { 'order': {
'type': 'integer', 'type': 'integer',
'minlength': 0, 'minlength': 0,
@ -286,14 +282,7 @@ nodes_schema = {
'revision': { 'revision': {
'type': 'integer', 'type': 'integer',
}, },
'parent': { 'parent': _node_embedded_schema,
'type': 'objectid',
'data_relation': {
'resource': 'nodes',
'field': '_id',
'embeddable': True
},
},
'project': { 'project': {
'type': 'objectid', 'type': 'objectid',
'data_relation': { 'data_relation': {