Add challenge map service
This commit is contained in:
12
common/models/block.js
Normal file
12
common/models/block.js
Normal file
@@ -0,0 +1,12 @@
|
||||
import { Observable } from 'rx';
|
||||
|
||||
export default function(Block) {
|
||||
Block.on('dataSourceAttached', () => {
|
||||
Block.findOne$ =
|
||||
Observable.fromNodeCallback(Block.findOne, Block);
|
||||
Block.findById$ =
|
||||
Observable.fromNodeCallback(Block.findById, Block);
|
||||
Block.find$ =
|
||||
Observable.fromNodeCallback(Block.find, Block);
|
||||
});
|
||||
}
|
49
common/models/block.json
Normal file
49
common/models/block.json
Normal file
@@ -0,0 +1,49 @@
|
||||
{
|
||||
"name": "block",
|
||||
"base": "PersistedModel",
|
||||
"idInjection": true,
|
||||
"options": {
|
||||
"validateUpsert": true
|
||||
},
|
||||
"properties": {
|
||||
"superBlock": {
|
||||
"type": "string",
|
||||
"required": true,
|
||||
"description": "The super block that this block belongs too"
|
||||
},
|
||||
"order": {
|
||||
"type": "number",
|
||||
"required": true,
|
||||
"description": "the order in which this block appears"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"required": true,
|
||||
"description": "The name of this block derived from the title, suitable for regex search"
|
||||
},
|
||||
"superOrder": {
|
||||
"type": "number",
|
||||
"required": true
|
||||
},
|
||||
"dashedName": {
|
||||
"type": "string",
|
||||
"required": true,
|
||||
"description": "Generated from the title to be URL friendly"
|
||||
},
|
||||
"title": {
|
||||
"type": "string",
|
||||
"required": true,
|
||||
"description": "The title of this block, suitable for display"
|
||||
}
|
||||
},
|
||||
"validations": [],
|
||||
"relations": {
|
||||
"challenges": {
|
||||
"type": "hasMany",
|
||||
"model": "challenge",
|
||||
"foreignKey": "blockId"
|
||||
}
|
||||
},
|
||||
"acls": [],
|
||||
"methods": {}
|
||||
}
|
Reference in New Issue
Block a user