Add challenge map service

This commit is contained in:
Berkeley Martinez
2016-03-11 21:45:58 -08:00
parent f29545ef6c
commit 4514d39eff
8 changed files with 227 additions and 42 deletions

12
common/models/block.js Normal file
View 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
View 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": {}
}