aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/apiParse.js46
-rw-r--r--scripts/createExceptions.js2
-rwxr-xr-xscripts/purge-except-git.sh31
3 files changed, 78 insertions, 1 deletions
diff --git a/scripts/apiParse.js b/scripts/apiParse.js
new file mode 100644
index 00000000..138a82f4
--- /dev/null
+++ b/scripts/apiParse.js
@@ -0,0 +1,46 @@
+var debug = require('debug')('debug')
+
+const addUserSearch = function (input, table) {
+ debug('add User Search')
+ var {search, starts_with, contains} = input
+
+ if (!table) { table = 'Users' }
+ // if (since) cmd = cmd.havingRaw('invoices + payments + deposits + orders > ?', [0])
+
+ if (search) {
+ if (starts_with) {
+ search = search + '%'
+ } else if (contains) {
+ search = '%' + search + '%'
+ }
+
+ var condition = "(" + table + ".email like '" + search + "' OR " + table + ".username like '" + search + "')"
+
+ debug('condition: ' + condition)
+ return condition
+ } else {
+ return ''
+ }
+}
+
+const addTimeSearch = function (input, field) {
+ debug('add time Search')
+ if (!field) { field = 'updatedAt' }
+
+ var {since} = input
+ if (since) {
+
+ condition = field + " >= '" + since + "'"
+ debug('condition: ' + condition)
+
+ return condition
+ } else {
+ return ''
+ }
+}
+
+module.exports = {
+ addUserSearch: addUserSearch,
+ addTimeSearch: addTimeSearch,
+}
+
diff --git a/scripts/createExceptions.js b/scripts/createExceptions.js
index bec6ebc6..26baeb7e 100644
--- a/scripts/createExceptions.js
+++ b/scripts/createExceptions.js
@@ -1,4 +1,4 @@
-BitcoinCore = require("bitcoin-core");
+BitcoinCore = require("@asoltys/bitcoin-core");
fs = require("fs");
config = require("./config");
bc = new BitcoinCore(config.bitcoin);
diff --git a/scripts/purge-except-git.sh b/scripts/purge-except-git.sh
new file mode 100755
index 00000000..066b082f
--- /dev/null
+++ b/scripts/purge-except-git.sh
@@ -0,0 +1,31 @@
+#!/bin/bash
+# purge coinos-ui and coinos-server
+# ie- fresh install/clean working dirs but without the clone -
+# useful for local dev when you have stashed changes or branches
+# you don't want to destroy
+
+# start script from coinos-server/scripts ie:
+# $ cd /var/node/coinos-server/scripts
+# $ ./purge-except-git.sh
+
+# you may have to run it with sudo to remove the directories created by docker
+
+# and now the script will move up a dir and do its thing:
+cd ../
+
+# if you have docker-compose process running
+docker-compose down
+
+#purge:
+rm -rf config
+rm -rf mysql
+rm -rf node_modules
+rm .env
+rm fx
+rm docker-compose.override.yml
+
+#also on ui:
+cd ../coinos-ui
+rm -rf node_modules
+
+# (and then follow instructions in root README to rebuild/install)