-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from ccem-dev/release-1.1.0
[RELEASE] release-1.1.0 into master
- Loading branch information
Showing
25 changed files
with
635 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ logs | |
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
source/.npmrc | ||
# Runtime data | ||
pids | ||
*.pid | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,27 @@ | ||
const fs = require('fs'); | ||
module.exports = function (application) { | ||
const Response = application.app.utils.Response; | ||
const VariableTypeCorrelation = application.app.models.VariableTypeCorrelation; | ||
const Response = application.app.utils.Response; | ||
const VariableTypeCorrelation = application.app.models.VariableTypeCorrelation; | ||
|
||
return { | ||
uploadVariableTypeCorrelation: async function (variableTypeCorrelationJson) { | ||
let promises = []; | ||
let buffer = fs.readFileSync(variableTypeCorrelationJson.path); | ||
let parsedJson = JSON.parse(buffer); | ||
return { | ||
uploadVariableTypeCorrelation: async function (variableTypeCorrelationJson) { | ||
let promises = []; | ||
let buffer = fs.readFileSync(variableTypeCorrelationJson.path); | ||
let parsedJson = JSON.parse(buffer); | ||
|
||
let correlationLength = parsedJson.length; | ||
for (let i = 0; i < correlationLength; i++) { | ||
promises.push(VariableTypeCorrelation.updateVariableTypeCorrelation(parsedJson[i])) | ||
} | ||
let correlationLength = parsedJson.length; | ||
for (let i = 0; i < correlationLength; i++) { | ||
promises.push(VariableTypeCorrelation.updateVariableTypeCorrelation(parsedJson[i])) | ||
} | ||
|
||
try { | ||
fs.unlinkSync(variableTypeCorrelationJson.path); | ||
await Promise.all(promises); | ||
return Response.success(); | ||
} catch (e) { | ||
throw Response.internalServerError(); | ||
} | ||
} | ||
}; | ||
try { | ||
fs.unlinkSync(variableTypeCorrelationJson.path); | ||
await Promise.all(promises); | ||
return Response.success(); | ||
} catch (e) { | ||
throw Response.internalServerError(); | ||
} | ||
} | ||
}; | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,28 @@ | ||
module.exports.success = function (body) { | ||
let response = {}; | ||
response.code = 200; | ||
response.body = {data: body || true}; | ||
response.body = { data: body || true }; | ||
return response; | ||
}; | ||
|
||
module.exports.notAcceptable = function (body) { | ||
let err = {}; | ||
err.code = 406; | ||
err.body = {data: body || {message: 'Value not acceptable'}}; | ||
err.body = { data: body || { message: 'Value not acceptable' } }; | ||
return err; | ||
}; | ||
|
||
module.exports.internalServerError = function (body) { | ||
let err = {}; | ||
err.code = 500; | ||
err.body = {data: body || {message: 'There was an error. Please try again later.'}}; | ||
err.body = { data: body || { message: 'There was an error. Please try again later.' } }; | ||
return err; | ||
}; | ||
|
||
module.exports.notFound = function (body) { | ||
let err = {}; | ||
err.code = 404; | ||
err.body = {data: body || {message: 'Data not found'}}; | ||
err.body = { data: body || { message: 'Data not found' } }; | ||
return err; | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,18 @@ | ||
const path = require('path'); | ||
const Response = require('../../app/utils/Response.js'); | ||
|
||
module.exports.validateFileContainer = (fileContainer, ext) => { | ||
return new Promise(function (resolve, reject) { | ||
let errorMessage; | ||
if(!fileContainer){ | ||
errorMessage = 'The databaseJson field is required'; | ||
} else if(path.extname(fileContainer[0].originalname) !== ext){ | ||
errorMessage = 'Invalid File Type. Only JSON files are allowed'; | ||
} | ||
if (errorMessage){ | ||
reject(Response.notAcceptable({data:'The databaseJson field is required'})); | ||
} else { | ||
resolve(fileContainer[0]) | ||
} | ||
}); | ||
return new Promise(function (resolve, reject) { | ||
let errorMessage; | ||
if (!fileContainer) { | ||
errorMessage = 'The databaseJson field is required'; | ||
} else if (path.extname(fileContainer[0].originalname) !== ext) { | ||
errorMessage = 'Invalid File Type. Only JSON files are allowed'; | ||
} | ||
if (errorMessage) { | ||
reject(Response.notAcceptable({data: 'The databaseJson field is required'})); | ||
} else { | ||
resolve(fileContainer[0]) | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
var gulp = require('gulp'); | ||
var browserSync = require('browser-sync').create(); | ||
|
||
|
||
gulp.task('browser-sync', function() { | ||
browserSync.init({ | ||
proxy: "localhost:8080", | ||
reloadDelay: 400, | ||
files: [ | ||
"app/views/*/*.ejs", | ||
"app/routes/*.js", | ||
"app/models/*.js", | ||
"app/controllers/*.js", | ||
"config/*.js" | ||
], | ||
open: "external" | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
module.exports = { | ||
mongodbMemoryServerOptions: { | ||
instance: { | ||
dbName: 'jest' | ||
}, | ||
binary: { | ||
version: '4.0.2', // Version of MongoDB | ||
skipMD5: true | ||
}, | ||
autoStart: false | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
module.exports = { | ||
preset: '@shelf/jest-mongodb', | ||
collectCoverage: true, | ||
collectCoverageFrom: [ | ||
"**/app/**/*.js", | ||
'**/tests/**/*-spec.js' | ||
], | ||
moduleFileExtensions: ['js', 'jsx', 'json', 'vue'], | ||
testMatch: [ | ||
"**/tests/**/*-spec.js" | ||
], | ||
transformIgnorePatterns: ['<rootDir>/node_modules/'], | ||
transform: { | ||
'^.+\\.vue$': 'vue-jest', | ||
'.+\\.(css|styl|less|sass|scss|png|jpg|ttf|woff|woff2)$': 'jest-transform-stub', | ||
'^.+\\.(js|jsx)?$': 'babel-jest' | ||
}, | ||
moduleNameMapper: { | ||
'^@/(.*)$': '<rootDir>/src/$1' | ||
} | ||
}; |
Oops, something went wrong.