got api subdomain to work with docs
This commit is contained in:
parent
8d2e502c44
commit
74c4f0b416
|
@ -21,3 +21,11 @@ exports.form = function(req, res) {
|
||||||
request: req
|
request: req
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
exports.redoc = function(req, res) {
|
||||||
|
res.render('redoc', {
|
||||||
|
request: req
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
|
|
@ -69,74 +69,6 @@ exports.uploadPDF = function(req, res, next) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Upload PDF
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
exports.uploadSubmissionFile = function(req, res, next) {
|
|
||||||
|
|
||||||
console.log('inside uploadPDF');
|
|
||||||
|
|
||||||
// console.log('\n\nProperty Descriptor\n-----------');
|
|
||||||
// console.log(Object.getOwnPropertyDescriptor(req.files.file, 'path'));
|
|
||||||
|
|
||||||
console.log(req.files);
|
|
||||||
|
|
||||||
if(req.files){
|
|
||||||
var file, _user, _path;
|
|
||||||
|
|
||||||
for(var i=0; i<req.files.length; i++){
|
|
||||||
file = req.files[i];
|
|
||||||
_user = req.user;
|
|
||||||
_path = file.path;
|
|
||||||
|
|
||||||
|
|
||||||
if (file.size === 0) {
|
|
||||||
return next(new Error('File uploaded is EMPTY'));
|
|
||||||
}else if(file.size > 100000000){
|
|
||||||
return next(new Error('File uploaded exceeds MAX SIZE of 100MB'));
|
|
||||||
}else {
|
|
||||||
fs.exists(_path, function(exists) {
|
|
||||||
|
|
||||||
//If file exists move to user's form directory
|
|
||||||
if(exists) {
|
|
||||||
var newDestination = config.tmpUploadPath+_user.username;
|
|
||||||
var stat = null;
|
|
||||||
try {
|
|
||||||
stat = fs.statSync(newDestination);
|
|
||||||
} catch (err) {
|
|
||||||
fs.mkdirSync(newDestination);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (stat && !stat.isDirectory()) {
|
|
||||||
console.log('Directory cannot be created');
|
|
||||||
return next(new Error('Directory cannot be created because an inode of a different type exists at "' + newDestination + '"'));
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log(path.join(newDestination, pdfFile.filename));
|
|
||||||
|
|
||||||
fs.move(pdfFile.path, path.join(newDestination, pdfFile.filename), function (err) {
|
|
||||||
if (err) {
|
|
||||||
return next(new Error(err.message));
|
|
||||||
}
|
|
||||||
pdfFile.path = path.join(newDestination, pdfFile.filename);
|
|
||||||
console.log(pdfFile.filename + ' uploaded to ' + pdfFile.path);
|
|
||||||
res.json(pdfFile);
|
|
||||||
});
|
|
||||||
|
|
||||||
} else {
|
|
||||||
return next(new Error('Did NOT get your file!'));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}else {
|
|
||||||
return next(new Error('Uploaded files were NOT detected'));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete a forms submissions
|
* Delete a forms submissions
|
||||||
*/
|
*/
|
||||||
|
@ -254,23 +186,27 @@ exports.listSubmissions = function(req, res) {
|
||||||
* Create a new form
|
* Create a new form
|
||||||
*/
|
*/
|
||||||
exports.create = function(req, res) {
|
exports.create = function(req, res) {
|
||||||
|
|
||||||
|
|
||||||
|
if(!req.body.form){
|
||||||
|
console.log(err);
|
||||||
|
return res.status(400).send({
|
||||||
|
message: "Invalid Input"
|
||||||
|
});
|
||||||
|
}
|
||||||
var form = new Form(req.body.form);
|
var form = new Form(req.body.form);
|
||||||
|
|
||||||
form.admin = req.user._id;
|
form.admin = req.user._id;
|
||||||
console.log('Create a new form');
|
|
||||||
console.log(form);
|
|
||||||
console.log(req.body.form);
|
|
||||||
console.log(req.user);
|
|
||||||
|
|
||||||
form.save(function(err) {
|
form.save(function(err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
res.status(400).send({
|
return res.status(405).send({
|
||||||
message: errorHandler.getErrorMessage(err)
|
message: errorHandler.getErrorMessage(err)
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
res.json(form);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
res.json(form);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -300,7 +236,7 @@ exports.update = function(req, res) {
|
||||||
delete req.body.form.__v;
|
delete req.body.form.__v;
|
||||||
delete req.body.form._id;
|
delete req.body.form._id;
|
||||||
|
|
||||||
//Unless we have 'admin' priviledges, updating form admin is disabled
|
//Unless we have 'admin' privileges, updating form admin is disabled
|
||||||
if(req.user.roles.indexOf('admin') === -1) delete req.body.form.admin;
|
if(req.user.roles.indexOf('admin') === -1) delete req.body.form.admin;
|
||||||
|
|
||||||
//Do this so we can create duplicate fields
|
//Do this so we can create duplicate fields
|
||||||
|
@ -317,7 +253,7 @@ exports.update = function(req, res) {
|
||||||
form.save(function(err, form) {
|
form.save(function(err, form) {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
res.status(400).send({
|
res.status(405).send({
|
||||||
message: errorHandler.getErrorMessage(err)
|
message: errorHandler.getErrorMessage(err)
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -377,7 +313,7 @@ exports.formByID = function(req, res, next, id) {
|
||||||
if (err) {
|
if (err) {
|
||||||
return next(err);
|
return next(err);
|
||||||
} else if (form === undefined || form === null) {
|
} else if (form === undefined || form === null) {
|
||||||
res.status(400).send({
|
res.status(404).send({
|
||||||
message: 'Form not found'
|
message: 'Form not found'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,9 @@ var forms = require('../../app/controllers/forms.server.controller'),
|
||||||
module.exports = function(app) {
|
module.exports = function(app) {
|
||||||
// Root routing
|
// Root routing
|
||||||
app.route('/').get(core.index);
|
app.route('/').get(core.index);
|
||||||
app.route('/subdomain/([a-zA-Z0-9]+)/').get(core.form);
|
app.route('/subdomain/api/').get(core.redoc);
|
||||||
app.route('/subdomain/*/forms/:formId([a-zA-Z0-9]+)')
|
app.route('/subdomain/^(?!api$)[A-Za-z0-9]*/').get(core.form);
|
||||||
|
app.route('/subdomain/^(?!api$)[A-Za-z0-9]*/forms/:formId([a-zA-Z0-9]+)')
|
||||||
.get(forms.read)
|
.get(forms.read)
|
||||||
.post(forms.createSubmission);
|
.post(forms.createSubmission);
|
||||||
};
|
};
|
||||||
|
|
100
app/views/redoc.server.view.html
Normal file
100
app/views/redoc.server.view.html
Normal file
|
@ -0,0 +1,100 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<title>{{title}}</title>
|
||||||
|
|
||||||
|
<!-- General META -->
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||||
|
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1">
|
||||||
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||||
|
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||||
|
|
||||||
|
<!-- Semantic META -->
|
||||||
|
<meta name="keywords" content="{{keywords}}">
|
||||||
|
<meta name="description" content="{{description}}">
|
||||||
|
|
||||||
|
<!-- Facebook META -->
|
||||||
|
<meta property="og:site_name" content="{{title}}">
|
||||||
|
<meta property="og:title" content="{{title}}">
|
||||||
|
<meta property="og:description" content="{{description}}">
|
||||||
|
<meta property="og:url" content="{{url}}">
|
||||||
|
<meta property="og:image" content="/img/brand/logo.png">
|
||||||
|
<meta property="og:type" content="website">
|
||||||
|
|
||||||
|
<!-- Twitter META -->
|
||||||
|
<meta name="twitter:title" content="{{title}}">
|
||||||
|
<meta name="twitter:description" content="{{description}}">
|
||||||
|
<meta name="twitter:url" content="{{url}}">
|
||||||
|
<meta name="twitter:image" content="/img/brand/logo.png">
|
||||||
|
|
||||||
|
<!-- Fav Icon -->
|
||||||
|
<link href="/static/modules/core/img/brand/favicon.ico" rel="shortcut icon" type="image/x-icon">
|
||||||
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.1/css/font-awesome.min.css">
|
||||||
|
<link rel="stylesheet" href="/static/lib/bootstrap/dist/css/bootstrap.min.css">
|
||||||
|
<link rel='stylesheet' href='https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,900'>
|
||||||
|
|
||||||
|
<!--Bower CSS dependencies-->
|
||||||
|
{% for bowerCssFile in bowerCssFiles %}
|
||||||
|
<link rel="stylesheet" href="{{bowerCssFile}}">
|
||||||
|
{% endfor %}
|
||||||
|
<link rel="stylesheet" href="/static//lib/jquery-ui/themes/flick/jquery-ui.css"/>
|
||||||
|
|
||||||
|
<!-- end Bower CSS dependencies-->
|
||||||
|
|
||||||
|
<!--Application CSS Files-->
|
||||||
|
{% for cssFile in cssFiles %}
|
||||||
|
<link rel="stylesheet" href="{{cssFile}}">
|
||||||
|
{% endfor %}
|
||||||
|
<!-- end Application CSS Files-->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- HTML5 Shim -->
|
||||||
|
<!--[if lt IE 9]>
|
||||||
|
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
|
||||||
|
<![endif]-->
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<redoc spec-url='/static/swagger.json'></redoc>
|
||||||
|
<script src="https://rebilly.github.io/ReDoc/releases/latest/redoc.min.js"> </script>
|
||||||
|
|
||||||
|
<!--Bower JS dependencies-->
|
||||||
|
{% for bowerJSFile in bowerJSFiles %}
|
||||||
|
<script type="text/javascript" src="{{bowerJSFile}}"></script>
|
||||||
|
{% endfor %}
|
||||||
|
<!-- end Bower JS dependencies-->
|
||||||
|
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/angular-strap/2.3.8/angular-strap.min.js"></script>
|
||||||
|
|
||||||
|
{% if process.env.NODE_ENV === 'development' %}
|
||||||
|
|
||||||
|
<script src="https://cdn.ravenjs.com/2.3.0/angular/raven.min.js"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
Raven.config('https://825fefd6b4ed4a4da199c1b832ca845c@sentry.tellform.com/2').install();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<!-- [if lt IE 9]>
|
||||||
|
<section class="browsehappy jumbotron hide">
|
||||||
|
<h1>Hello there!</h1>
|
||||||
|
<p>You are using an old browser which we unfortunately do not support.</p>
|
||||||
|
<p>Please <a href="http://browsehappy.com/">click here</a> to update your browser before using the website.</p>
|
||||||
|
<p><a href="http://browsehappy.com" class="btn btn-primary btn-lg" role="button">Yes, upgrade my browser!</a></p>
|
||||||
|
</section>
|
||||||
|
<![endif] -->
|
||||||
|
|
||||||
|
<script>
|
||||||
|
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||||
|
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||||
|
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||||
|
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
|
||||||
|
|
||||||
|
ga('create', '{{google_analytics_id}}', 'auto');
|
||||||
|
ga('send', 'pageview');
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
|
@ -72,7 +72,6 @@ module.exports = function(db) {
|
||||||
var subdomains = req.subdomains;
|
var subdomains = req.subdomains;
|
||||||
var host = req.hostname;
|
var host = req.hostname;
|
||||||
|
|
||||||
|
|
||||||
if(subdomains.slice(0, 4).join('.')+'' === '1.0.0.127'){
|
if(subdomains.slice(0, 4).join('.')+'' === '1.0.0.127'){
|
||||||
subdomains = subdomains.slice(4);
|
subdomains = subdomains.slice(4);
|
||||||
}
|
}
|
||||||
|
@ -81,16 +80,29 @@ module.exports = function(db) {
|
||||||
if (!subdomains.length) return next();
|
if (!subdomains.length) return next();
|
||||||
|
|
||||||
var urlPath = url.parse(req.url).path.split('/');
|
var urlPath = url.parse(req.url).path.split('/');
|
||||||
if(urlPath.indexOf('static')){
|
if(urlPath.indexOf('static') > -1){
|
||||||
urlPath.splice(1,1);
|
urlPath.splice(1,1);
|
||||||
req.root = 'https://' + config.baseUrl + urlPath.join('/');
|
req.root = 'https://' + config.baseUrl + urlPath.join('/');
|
||||||
return next();
|
return next();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(subdomains.indexOf('stage') || subdomains.indexOf('admin')){
|
if(subdomains.indexOf('stage') > -1 || subdomains.indexOf('admin') > -1){
|
||||||
return next();
|
return next();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(subdomains);
|
||||||
|
console.log("is api subdomain: "+ (subdomains.indexOf("api") > -1));
|
||||||
|
console.log(req.url);
|
||||||
|
if(subdomains.indexOf('api') > -1){
|
||||||
|
// rebuild url
|
||||||
|
path += 'api' + req.url;
|
||||||
|
console.log(req.url);
|
||||||
|
// TODO: check path and query strings are preserved
|
||||||
|
// reassign url
|
||||||
|
req.url = path;
|
||||||
|
console.log(req.url);
|
||||||
|
return next();
|
||||||
|
}
|
||||||
|
|
||||||
User.findOne({username: req.subdomains.reverse()[0]}).exec(function (err, user) {
|
User.findOne({username: req.subdomains.reverse()[0]}).exec(function (err, user) {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|
|
@ -5,14 +5,10 @@
|
||||||
"title": "TellForm API",
|
"title": "TellForm API",
|
||||||
"contact": {
|
"contact": {
|
||||||
"name": "TellForm Team",
|
"name": "TellForm Team",
|
||||||
"url": "http://tellform.com"
|
"url": "http://www.tellform.com"
|
||||||
},
|
|
||||||
"license": {
|
|
||||||
"name": "Creative Commons 4.0 International",
|
|
||||||
"url": "http://creativecommons.org/licenses/by/4.0/"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"host": "tellform.com",
|
"host": "api.tellform.com",
|
||||||
"basePath": "/api",
|
"basePath": "/api",
|
||||||
"schemes": [
|
"schemes": [
|
||||||
"http"
|
"http"
|
||||||
|
@ -23,8 +19,17 @@
|
||||||
"tags": [
|
"tags": [
|
||||||
"Form Operations"
|
"Form Operations"
|
||||||
],
|
],
|
||||||
"summary": "Finds forms in the system",
|
"summary": "Finds all forms",
|
||||||
"responses": {
|
"responses": {
|
||||||
|
"405": {
|
||||||
|
"description": "Missing Form Input"
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Form is Invalid"
|
||||||
|
},
|
||||||
|
"404": {
|
||||||
|
"description": "Form not Found"
|
||||||
|
},
|
||||||
"200": {
|
"200": {
|
||||||
"description": "forms response",
|
"description": "forms response",
|
||||||
"schema": {
|
"schema": {
|
||||||
|
@ -41,7 +46,125 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"/form/:form_id": {
|
||||||
|
"get": {
|
||||||
|
"tags": [
|
||||||
|
"Form Operations"
|
||||||
|
],
|
||||||
|
"summary": "Find form by ID",
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "forms response",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/Form"
|
||||||
|
},
|
||||||
|
"headers": {
|
||||||
|
"x-expires": {
|
||||||
|
"type": "string"
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"post": {
|
||||||
|
"tags": [
|
||||||
|
"Form Operations"
|
||||||
|
],
|
||||||
|
"summary": "Create a new form",
|
||||||
|
"description": "Create and save a new form",
|
||||||
|
"operationId": "addForm",
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"in": "body",
|
||||||
|
"name": "form",
|
||||||
|
"description": "Form object that is to be created",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/Form"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"405": {
|
||||||
|
"description": "Missing Form Input"
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Form is Invalid"
|
||||||
|
},
|
||||||
|
"404": {
|
||||||
|
"description": "Form not Found"
|
||||||
|
},
|
||||||
|
"200": {
|
||||||
|
"description": "successful operation",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/Form"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"security": [
|
||||||
|
],
|
||||||
|
"x-code-samples": [
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"put": {
|
||||||
|
"tags": [
|
||||||
|
"Form Operations"
|
||||||
|
],
|
||||||
|
"summary": "Update an existing form",
|
||||||
|
"description": "",
|
||||||
|
"operationId": "updateForm",
|
||||||
|
"consumes": [
|
||||||
|
"application/json",
|
||||||
|
"application/xml"
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"application/xml",
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"in": "body",
|
||||||
|
"name": "form",
|
||||||
|
"description": "Form object that needs to be updated",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/Form"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"405": {
|
||||||
|
"description": "Missing Form Input"
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Form is Invalid"
|
||||||
|
},
|
||||||
|
"404": {
|
||||||
|
"description": "Form not Found"
|
||||||
|
},
|
||||||
|
"200": {
|
||||||
|
"description": "successful operation",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/Form"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"x-code-samples": [
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
"definitions": {
|
"definitions": {
|
||||||
"User": {
|
"User": {
|
||||||
|
@ -63,7 +186,13 @@
|
||||||
},
|
},
|
||||||
"language": {
|
"language": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": ["en", "fr", "es", "it", "de"],
|
"enum": [
|
||||||
|
"en",
|
||||||
|
"fr",
|
||||||
|
"es",
|
||||||
|
"it",
|
||||||
|
"de"
|
||||||
|
],
|
||||||
"default": "en",
|
"default": "en",
|
||||||
"required": "User must have a language"
|
"required": "User must have a language"
|
||||||
},
|
},
|
||||||
|
@ -75,7 +204,7 @@
|
||||||
},
|
},
|
||||||
"username": {
|
"username": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"required": "Username cannot be blank"
|
"required": "Username cannot be blank",
|
||||||
"unique": "true"
|
"unique": "true"
|
||||||
},
|
},
|
||||||
"passwordHash": {
|
"passwordHash": {
|
||||||
|
@ -100,11 +229,17 @@
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": ["user", "admin", "superuser"]
|
"enum": [
|
||||||
|
"user",
|
||||||
|
"admin",
|
||||||
|
"superuser"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"default": ["user"]
|
"default": [
|
||||||
}
|
"user"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
},
|
||||||
"lastModified": {
|
"lastModified": {
|
||||||
"type": "date"
|
"type": "date"
|
||||||
},
|
},
|
||||||
|
@ -127,9 +262,34 @@
|
||||||
"sparse": true
|
"sparse": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"LogicJump": {
|
||||||
"LogicJump":
|
"expressionString": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"field == static",
|
||||||
|
"field != static",
|
||||||
|
"field > static",
|
||||||
|
"field >= static",
|
||||||
|
"field <= static",
|
||||||
|
"field < static",
|
||||||
|
"field contains static",
|
||||||
|
"field !contains static",
|
||||||
|
"field begins static",
|
||||||
|
"field !begins static",
|
||||||
|
"field ends static",
|
||||||
|
"field !ends static"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"fieldA": {
|
||||||
|
$ref: "#/definitions/FormField",
|
||||||
|
},
|
||||||
|
"valueB": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"jumpTo": {
|
||||||
|
"$ref": "#/definitions/FormField",
|
||||||
|
}
|
||||||
|
},
|
||||||
"FieldOption": {
|
"FieldOption": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
@ -145,7 +305,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
"RatingField": {
|
"RatingField": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
@ -180,14 +339,12 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
"FormField": {
|
"FormField": {
|
||||||
"required": [
|
"required": [
|
||||||
"title",
|
"title",
|
||||||
"fieldType"
|
"fieldType"
|
||||||
],
|
],
|
||||||
"properties": {
|
"properties": {
|
||||||
|
|
||||||
"isSubmission": {
|
"isSubmission": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"default": false
|
"default": false
|
||||||
|
@ -204,11 +361,9 @@
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"default": ""
|
"default": ""
|
||||||
},
|
},
|
||||||
|
|
||||||
"logicJump": {
|
"logicJump": {
|
||||||
"$ref": "#/definitions/FormFields"
|
"$ref": "#/definitions/FormField"
|
||||||
},
|
},
|
||||||
|
|
||||||
"ratingOptions": {
|
"ratingOptions": {
|
||||||
"type": "#/definitions/RatingField",
|
"type": "#/definitions/RatingField",
|
||||||
},
|
},
|
||||||
|
@ -224,7 +379,6 @@
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"default": false
|
"default": false
|
||||||
},
|
},
|
||||||
|
|
||||||
"deletePreserved": {
|
"deletePreserved": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"default": false
|
"default": false
|
||||||
|
@ -265,10 +419,8 @@
|
||||||
"fieldValue": {
|
"fieldValue": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
"VisitorData": {
|
"VisitorData": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
@ -293,7 +445,12 @@
|
||||||
},
|
},
|
||||||
"deviceType": {
|
"deviceType": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": ["desktop", "phone", "tablet", "other"],
|
"enum": [
|
||||||
|
"desktop",
|
||||||
|
"phone",
|
||||||
|
"tablet",
|
||||||
|
"other"
|
||||||
|
],
|
||||||
"default": "other"
|
"default": "other"
|
||||||
},
|
},
|
||||||
"userAgent": {
|
"userAgent": {
|
||||||
|
@ -306,7 +463,7 @@
|
||||||
"properties": {
|
"properties": {
|
||||||
"url": {
|
"url": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"pattern": "/((([A-Za-z]{3,9}:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)/"
|
"format": "url"
|
||||||
},
|
},
|
||||||
"action": {
|
"action": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
@ -326,6 +483,76 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"FormSubmission": {
|
||||||
|
"type": "object",
|
||||||
|
"required": [
|
||||||
|
"language",
|
||||||
|
"admin",
|
||||||
|
"title"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"title": {
|
||||||
|
"type": "string",
|
||||||
|
"required": "Form Title cannot be blank"
|
||||||
|
},
|
||||||
|
"language": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"en",
|
||||||
|
"fr",
|
||||||
|
"es",
|
||||||
|
"it",
|
||||||
|
"de"
|
||||||
|
],
|
||||||
|
"default": "en",
|
||||||
|
"required": "Form must have a language"
|
||||||
|
},
|
||||||
|
"admin": {
|
||||||
|
"$ref": "#/definitions/User",
|
||||||
|
},
|
||||||
|
"ipAddr": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"geoLocation": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"Country": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"Region": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"City": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"device": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"type": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"pdfFilePath": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"pdf": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
|
||||||
|
"timeElapsed": {
|
||||||
|
"type": "number"
|
||||||
|
},
|
||||||
|
"percentageComplete": {
|
||||||
|
"type": "number"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"Form": {
|
"Form": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"required": [
|
"required": [
|
||||||
|
@ -343,11 +570,18 @@
|
||||||
},
|
},
|
||||||
"language": {
|
"language": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"enum": ["en", "fr", "es", "it", "de"],
|
"enum": [
|
||||||
|
"en",
|
||||||
|
"fr",
|
||||||
|
"es",
|
||||||
|
"it",
|
||||||
|
"de"
|
||||||
|
],
|
||||||
"default": "en",
|
"default": "en",
|
||||||
"required": "Form must have a language"
|
"required": "Form must have a language"
|
||||||
},
|
},
|
||||||
"analytics": {
|
"analytics": {
|
||||||
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"gaCode": {
|
"gaCode": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
@ -360,10 +594,9 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
"form_fields": {
|
"form_fields": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": "#/definitions/FormFields"
|
"items": "#/definitions/FormField"
|
||||||
},
|
},
|
||||||
"submissions": {
|
"submissions": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
|
@ -371,19 +604,15 @@
|
||||||
"$ref": "#/definitions/FormSubmission"
|
"$ref": "#/definitions/FormSubmission"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
"admin": {
|
"admin": {
|
||||||
"$ref": "#/definitions/User",
|
"$ref": "#/definitions/User"
|
||||||
"required": "Form must have an Admin"
|
|
||||||
},
|
},
|
||||||
|
|
||||||
"pdf": {
|
"pdf": {
|
||||||
"type": "object"
|
"type": "object"
|
||||||
},
|
},
|
||||||
"pdfFieldMap": {
|
"pdfFieldMap": {
|
||||||
"type": "object"
|
"type": "object"
|
||||||
},
|
},
|
||||||
|
|
||||||
"startPage": {
|
"startPage": {
|
||||||
"properties": {
|
"properties": {
|
||||||
"showStart": {
|
"showStart": {
|
||||||
|
@ -407,7 +636,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
"hideFooter": {
|
"hideFooter": {
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"default": false
|
"default": false
|
||||||
|
@ -424,7 +652,6 @@
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"default": false
|
"default": false
|
||||||
},
|
},
|
||||||
|
|
||||||
"design": {
|
"design": {
|
||||||
"colors": {
|
"colors": {
|
||||||
"backgroundColor": {
|
"backgroundColor": {
|
||||||
|
@ -437,32 +664,25 @@
|
||||||
"match": "/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/",
|
"match": "/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/",
|
||||||
"default": "#333"
|
"default": "#333"
|
||||||
},
|
},
|
||||||
"answerColor"": {
|
"answerColor": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"match": "/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/",
|
"match": "/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/",
|
||||||
"default": "#333"
|
"default": "#333"
|
||||||
},
|
},
|
||||||
"buttonColor": {
|
"buttonColor": {
|
||||||
"type": "string"
|
"type": "string",
|
||||||
"match": "/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/",
|
"match": "/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/",
|
||||||
"default": "#fff"
|
"default": "#fff"
|
||||||
},
|
},
|
||||||
"buttonTextColor": {
|
"buttonTextColor": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"pattern": "[/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/]",
|
"pattern": "/^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/",
|
||||||
"default": "#333"
|
"default": "#333"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"font": "string"
|
"font": "string"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"Address": {
|
|
||||||
"type": "object",
|
|
||||||
"properties": {
|
|
||||||
"addressLine1": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue