Last change
on this file since 531 was
525,
checked in by hendrikvanantwerpen, 11 years ago
|
- Allow empty subcodes.
- Use HTTPResult exclusively on server (no more q).
- Set readonly & disabled on ourselves as well in _ComplexValueMixin
- Split server into several modules.
- Check codes on the variable level, not question level.
- We can add modules in design documents now.
|
File size:
618 bytes
|
Rev | Line | |
---|
[487] | 1 | var env = require('../env') |
---|
[525] | 2 | , HTTPResult = require('../util/http-result') |
---|
[487] | 3 | , upgradeCouch = require('../config/upgrade-couchdb') |
---|
| 4 | , cryptoken = require('../util/crypto-token') |
---|
| 5 | ; |
---|
| 6 | upgradeCouch(env.couchServerURL,env.dbName,function(doc){ |
---|
[525] | 7 | if ( (doc.type === 'Response' || doc.type === 'SurveyRun') && |
---|
| 8 | !doc.secret ) { |
---|
| 9 | return cryptoken() |
---|
| 10 | .then(function(token){ |
---|
[487] | 11 | doc.secret = token; |
---|
| 12 | return doc; |
---|
| 13 | }); |
---|
| 14 | } else { |
---|
[525] | 15 | return new HTTPResult(-1); |
---|
[487] | 16 | } |
---|
| 17 | }).then(function(res){ |
---|
| 18 | console.log("done",res); |
---|
| 19 | }, function(err){ |
---|
| 20 | console.error("fail",err); |
---|
| 21 | }); |
---|
Note: See
TracBrowser
for help on using the repository browser.