Ignore:
Timestamp:
12/04/12 16:29:49 (12 years ago)
Author:
hendrikvanantwerpen
Message:

Support data validation and increase dendency separation.

Added json-schema validation before documents are saved. Acts both as
a safe-guard and as a reference of the data model.

Added directory for server related material. For now it contains scripts
to configure CouchDB and check validity of documents against the schema.

Started separating out parts that depend on the data model from parts
that do not.

Location:
Dev/branches/rest-dojo-ui/server
Files:
3 added
1 copied
1 moved

Legend:

Unmodified
Added
Removed
  • Dev/branches/rest-dojo-ui/server/couchdb-admin/config/data/design-docs.js

    r414 r415  
    2626            validate_doc_update: function(newDoc, oldDoc, userCtx, secObj) {
    2727                if ( oldDoc && oldDoc.publicationDate ) { throw({forbidden:'Published documents cannot be modified.'}); }
    28                 if ( !newDoc._deleted && !newDoc.type ) { throw({forbidden:'Documents must have a type field.'}); }
    2928            },
    3029            views: {
     
    4039            _id: "_design/questions",
    4140            language: "javascript",
    42             validate_doc_update: function(newDoc, oldDoc, userCtx, secObj) {
    43                 if( newDoc._deleted || newDoc.type!=='Question' ){ return; }
    44                 if( !newDoc.code ){ throw({forbidden:'Question must have a code field.'});}
    45             },
    4641            views: {
    4742                all: {
Note: See TracChangeset for help on using the changeset viewer.