Add class creation logic with validation

This commit is contained in:
Drew Gross
2016-02-05 09:42:35 -08:00
parent 6a3718e8dc
commit d934f3a863
4 changed files with 298 additions and 11 deletions

View File

@@ -5,7 +5,7 @@ var express = require('express'),
var router = new PromiseRouter();
function mongoFieldTypeToApiResponseType(type) {
function mongoFieldTypeToSchemaAPIType(type) {
if (type[0] === '*') {
return {
type: 'Pointer',
@@ -34,7 +34,7 @@ function mongoSchemaAPIResponseFields(schema) {
fieldNames = Object.keys(schema).filter(key => key !== '_id');
response = {};
fieldNames.forEach(fieldName => {
response[fieldName] = mongoFieldTypeToApiResponseType(schema[fieldName]);
response[fieldName] = mongoFieldTypeToSchemaAPIType(schema[fieldName]);
});
response.ACL = {type: 'ACL'};
response.createdAt = {type: 'Date'};