diff --git a/.gitignore b/.gitignore index 0d5034b..2f9baf4 100644 --- a/.gitignore +++ b/.gitignore @@ -45,6 +45,8 @@ Thumbs.db resource/ +backup/collections/ + .idea/ node_modules */nbproject* diff --git a/api/resource/decoration/.keep b/api/resource/decoration/.keep deleted file mode 100644 index 8d1c8b6..0000000 --- a/api/resource/decoration/.keep +++ /dev/null @@ -1 +0,0 @@ - diff --git a/api/resource/rank/.keep b/api/resource/rank/.keep deleted file mode 100644 index 8d1c8b6..0000000 --- a/api/resource/rank/.keep +++ /dev/null @@ -1 +0,0 @@ - diff --git a/api/resource/signature/big/.keep b/api/resource/signature/big/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/api/resource/squad/.keep b/api/resource/squad/.keep deleted file mode 100644 index 8d1c8b6..0000000 --- a/api/resource/squad/.keep +++ /dev/null @@ -1 +0,0 @@ - diff --git a/api/server.js b/api/server.js index 9cab504..9f289b0 100644 --- a/api/server.js +++ b/api/server.js @@ -105,7 +105,15 @@ if (process.env.NODE_ENV !== config.test.env) { }); } else { mongoose.connect(config.database.uri + config.test.db); + for (let collection in mongoose.connection.collections) { + mongoose.connection.collections[collection].drop(function (err) { + if (err) { + console.log('Error while test-Db clean up: ' + err); + } + }); + } app.listen(config.test.port); + console.log('Listening on port ' + config.test.port); } module.exports = app; diff --git a/backup/backup.sh b/backup/backup.sh new file mode 100755 index 0000000..a85aac4 --- /dev/null +++ b/backup/backup.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +col=(app_user awarding decoration rank squad user) + +for i in "${col[@]}" +do + if [ "$1" == "restore" ] + then + mongoimport --db cc --collection $i --file collections/${i}.json + else + mongoexport --db cc --collection $i --out collections/${i}.json; + fi +done diff --git a/mongodb-data/.keep b/mongodb-data/.keep deleted file mode 100644 index 8d1c8b6..0000000 --- a/mongodb-data/.keep +++ /dev/null @@ -1 +0,0 @@ - diff --git a/package.json b/package.json index 3eada58..735d989 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "postinstall": "npm install --prefix ./static && npm install --prefix ./api", "mongodb": "mongod --dbpath ./mongodb-data", "test": "npm test --prefix ./api", - "e2e": "npm run deploy-static && concurrently \"npm run e2e --prefix ./api\" \"$(npm bin)/wait-on -t 60000 http://localhost:3001/ && npm run e2e --prefix ./static\" --success first --kill-others", + "e2e": "npm run deploy-static && concurrently \"npm run e2e --prefix ./api\" \"wait-on -t 60000 http://localhost:3001/ && npm run e2e --prefix ./static\" --success first --kill-others", "start-e2e": "npm run deploy-static && npm run e2e --prefix ./api", "test-e2e": "npm run e2e --prefix ./static" }, diff --git a/static/package.json b/static/package.json index df46b5c..1338de1 100644 --- a/static/package.json +++ b/static/package.json @@ -13,7 +13,7 @@ }, "dependencies": { "@angular/common": "^4.1.1", - "@angular/cli": "1.0.2", + "@angular/cli": "1.0.5", "@angular/compiler": "^4.1.1", "@angular/compiler-cli": "^4.1.1", "@angular/core": "^4.1.1",