2015-06-29 22:51:29 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Module dependencies.
|
|
|
|
*/
|
|
|
|
var users = require('../../app/controllers/users.server.controller'),
|
|
|
|
forms = require('../../app/controllers/forms.server.controller');
|
|
|
|
|
|
|
|
module.exports = function(app) {
|
|
|
|
// Form Routes
|
|
|
|
app.route('/upload/pdf')
|
2015-06-30 06:12:32 +00:00
|
|
|
.post(users.requiresLogin, forms.uploadPDF);
|
2015-06-29 22:51:29 +00:00
|
|
|
|
|
|
|
app.route('/forms')
|
2015-07-01 23:14:39 +00:00
|
|
|
.get(users.requiresLogin, forms.list)
|
2015-06-29 22:51:29 +00:00
|
|
|
.post(users.requiresLogin, forms.create);
|
|
|
|
|
2015-07-02 23:34:00 +00:00
|
|
|
app.route('/forms/:formId([a-zA-Z0-9]+)')
|
2015-06-29 22:51:29 +00:00
|
|
|
.get(forms.read)
|
2015-07-07 01:56:38 +00:00
|
|
|
.post(forms.createSubmission)
|
2015-06-29 22:51:29 +00:00
|
|
|
.put(users.requiresLogin, forms.hasAuthorization, forms.update)
|
2015-06-30 17:36:51 +00:00
|
|
|
.delete(users.requiresLogin, forms.hasAuthorization, forms.delete);
|
2015-06-29 22:51:29 +00:00
|
|
|
|
2015-07-02 23:34:00 +00:00
|
|
|
app.route('/forms/:formId([a-zA-Z0-9]+)/submissions')
|
2015-07-21 23:25:45 +00:00
|
|
|
.get(users.requiresLogin, forms.hasAuthorization, forms.listSubmissions);
|
2015-07-02 23:34:00 +00:00
|
|
|
|
2015-06-29 22:51:29 +00:00
|
|
|
// Finish by binding the form middleware
|
|
|
|
app.param('formId', forms.formByID);
|
|
|
|
};
|