summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Fridman <fridman@mail.sfsu.edu>2015-04-10 22:37:33 -0400
committerSean Fridman <fridman@mail.sfsu.edu>2015-04-11 01:38:43 -0400
commit1eff07c9c2ca5b61a28a1037a586d25c3791d67b (patch)
tree605a17b53152560a5dc4e9e68bdda1c9f439279e
parentfd0d777ee81219577ef9416fab7f985920c3ae29 (diff)
Add autoincrementing index to resources
-rw-r--r--app/index.js2
-rw-r--r--app/node_modules/okschema/index.js5
2 files changed, 7 insertions, 0 deletions
diff --git a/app/index.js b/app/index.js
index fc38b0a..e462b48 100644
--- a/app/index.js
+++ b/app/index.js
@@ -122,6 +122,8 @@ OKCMS.prototype._createSchemas = function(schemaConfig) {
schemaConfig = schemaConfig || {};
return Object.keys(schemaConfig).reduce(function(cache, key) {
var spec = schemaConfig[key];
+ // All resources have an autoincrementing index so we can order them suckas
+ spec.__index = {type: 'meta', autoincrement: true};
cache[key] = OKSchema(spec);
return cache;
}, {});
diff --git a/app/node_modules/okschema/index.js b/app/node_modules/okschema/index.js
index 4633e7a..d53ed7b 100644
--- a/app/node_modules/okschema/index.js
+++ b/app/node_modules/okschema/index.js
@@ -56,6 +56,11 @@ var types = {
}];
}
}
+ },
+ // Special type for resource meta information
+ 'meta': {
+ parent: 'string',
+ assertValid: function(spec, value) {}
}
}