From 8f1d398ff54cdb677cd555b8fcddfe6b28edcade Mon Sep 17 00:00:00 2001 From: markfridman Date: Sat, 19 Jan 2019 16:27:19 +0200 Subject: [PATCH 1/4] added basic round route and get/post round --- package-lock.json | 697 ++++++++--------------------------- server/routes/ticketAlloc.js | 70 ++++ server/server.js | 1 + 3 files changed, 228 insertions(+), 540 deletions(-) create mode 100644 server/routes/ticketAlloc.js diff --git a/package-lock.json b/package-lock.json index 9d9b2dfd..c32762ab 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3387,14 +3387,14 @@ "dev": true }, "fill-range": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.3.tgz", - "integrity": "sha1-ULd9/X5Gm8dJJHCWNpn+eoSFpyM=", + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.4.tgz", + "integrity": "sha512-cnrcCbj01+j2gTG921VZPnHbjmdAf8oQV/iGeV2kZxGSyfYjjTyY79ErsK1WJWMpw6DaApEX72binqJE+/d+5Q==", "dev": true, "requires": { "is-number": "^2.1.0", "isobject": "^2.0.0", - "randomatic": "^1.1.3", + "randomatic": "^3.0.0", "repeat-element": "^1.1.2", "repeat-string": "^1.5.2" }, @@ -3524,45 +3524,35 @@ "dev": true }, "fsevents": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.1.3.tgz", - "integrity": "sha512-WIr7iDkdmdbxu/Gh6eKEZJL6KPE74/5MEsf2whTOFNxbIoIixogroLdKYqB6FDav4Wavh/lZdzzd3b2KxIXC5Q==", + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.7.tgz", + "integrity": "sha512-Pxm6sI2MeBD7RdD12RYsqaP0nMiwx8eZBXCa6z2L+mRHm2DYrOYwihmhjpkdjUHwQhslWQjRpEgNq4XvBmaAuw==", "dev": true, "optional": true, "requires": { - "nan": "^2.3.0", - "node-pre-gyp": "^0.6.39" + "nan": "^2.9.2", + "node-pre-gyp": "^0.10.0" }, "dependencies": { "abbrev": { - "version": "1.1.0", + "version": "1.1.1", "bundled": true, "dev": true, "optional": true }, - "ajv": { - "version": "4.11.8", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "co": "^4.6.0", - "json-stable-stringify": "^1.0.1" - } - }, "ansi-regex": { "version": "2.1.1", "bundled": true, "dev": true }, "aproba": { - "version": "1.1.1", + "version": "1.2.0", "bundled": true, "dev": true, "optional": true }, "are-we-there-yet": { - "version": "1.1.4", + "version": "1.1.5", "bundled": true, "dev": true, "optional": true, @@ -3571,88 +3561,22 @@ "readable-stream": "^2.0.6" } }, - "asn1": { - "version": "0.2.3", - "bundled": true, - "dev": true, - "optional": true - }, - "assert-plus": { - "version": "0.2.0", - "bundled": true, - "dev": true, - "optional": true - }, - "asynckit": { - "version": "0.4.0", - "bundled": true, - "dev": true, - "optional": true - }, - "aws-sign2": { - "version": "0.6.0", - "bundled": true, - "dev": true, - "optional": true - }, - "aws4": { - "version": "1.6.0", - "bundled": true, - "dev": true, - "optional": true - }, "balanced-match": { - "version": "0.4.2", + "version": "1.0.0", "bundled": true, "dev": true }, - "bcrypt-pbkdf": { - "version": "1.0.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "tweetnacl": "^0.14.3" - } - }, - "block-stream": { - "version": "0.0.9", - "bundled": true, - "dev": true, - "requires": { - "inherits": "~2.0.0" - } - }, - "boom": { - "version": "2.10.1", - "bundled": true, - "dev": true, - "requires": { - "hoek": "2.x.x" - } - }, "brace-expansion": { - "version": "1.1.7", + "version": "1.1.11", "bundled": true, "dev": true, "requires": { - "balanced-match": "^0.4.1", + "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, - "buffer-shims": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, - "caseless": { - "version": "0.12.0", - "bundled": true, - "dev": true, - "optional": true - }, - "co": { - "version": "4.6.0", + "chownr": { + "version": "1.1.1", "bundled": true, "dev": true, "optional": true @@ -3662,14 +3586,6 @@ "bundled": true, "dev": true }, - "combined-stream": { - "version": "1.0.5", - "bundled": true, - "dev": true, - "requires": { - "delayed-stream": "~1.0.0" - } - }, "concat-map": { "version": "0.0.1", "bundled": true, @@ -3683,35 +3599,11 @@ "core-util-is": { "version": "1.0.2", "bundled": true, - "dev": true - }, - "cryptiles": { - "version": "2.0.5", - "bundled": true, - "dev": true, - "requires": { - "boom": "2.x.x" - } - }, - "dashdash": { - "version": "1.14.1", - "bundled": true, "dev": true, - "optional": true, - "requires": { - "assert-plus": "^1.0.0" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "optional": true - } - } + "optional": true }, "debug": { - "version": "2.6.8", + "version": "2.6.9", "bundled": true, "dev": true, "optional": true, @@ -3720,16 +3612,11 @@ } }, "deep-extend": { - "version": "0.4.2", + "version": "0.6.0", "bundled": true, "dev": true, "optional": true }, - "delayed-stream": { - "version": "1.0.0", - "bundled": true, - "dev": true - }, "delegates": { "version": "1.0.0", "bundled": true, @@ -3737,74 +3624,25 @@ "optional": true }, "detect-libc": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "optional": true - }, - "ecc-jsbn": { - "version": "0.1.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "jsbn": "~0.1.0" - } - }, - "extend": { - "version": "3.0.1", - "bundled": true, - "dev": true, - "optional": true - }, - "extsprintf": { - "version": "1.0.2", - "bundled": true, - "dev": true - }, - "forever-agent": { - "version": "0.6.1", + "version": "1.0.3", "bundled": true, "dev": true, "optional": true }, - "form-data": { - "version": "2.1.4", + "fs-minipass": { + "version": "1.2.5", "bundled": true, "dev": true, "optional": true, "requires": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.5", - "mime-types": "^2.1.12" + "minipass": "^2.2.1" } }, "fs.realpath": { "version": "1.0.0", "bundled": true, - "dev": true - }, - "fstream": { - "version": "1.0.11", - "bundled": true, "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "inherits": "~2.0.0", - "mkdirp": ">=0.5 0", - "rimraf": "2" - } - }, - "fstream-ignore": { - "version": "1.0.5", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "fstream": "^1.0.0", - "inherits": "2", - "minimatch": "^3.0.0" - } + "optional": true }, "gauge": { "version": "2.7.4", @@ -3822,27 +3660,11 @@ "wide-align": "^1.1.0" } }, - "getpass": { - "version": "0.1.7", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "assert-plus": "^1.0.0" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "optional": true - } - } - }, "glob": { - "version": "7.1.2", + "version": "7.1.3", "bundled": true, "dev": true, + "optional": true, "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -3852,64 +3674,35 @@ "path-is-absolute": "^1.0.0" } }, - "graceful-fs": { - "version": "4.1.11", - "bundled": true, - "dev": true - }, - "har-schema": { - "version": "1.0.5", - "bundled": true, - "dev": true, - "optional": true - }, - "har-validator": { - "version": "4.2.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "ajv": "^4.9.1", - "har-schema": "^1.0.5" - } - }, "has-unicode": { "version": "2.0.1", "bundled": true, "dev": true, "optional": true }, - "hawk": { - "version": "3.1.3", + "iconv-lite": { + "version": "0.4.24", "bundled": true, "dev": true, + "optional": true, "requires": { - "boom": "2.x.x", - "cryptiles": "2.x.x", - "hoek": "2.x.x", - "sntp": "1.x.x" + "safer-buffer": ">= 2.1.2 < 3" } }, - "hoek": { - "version": "2.16.3", - "bundled": true, - "dev": true - }, - "http-signature": { - "version": "1.1.1", + "ignore-walk": { + "version": "3.0.1", "bundled": true, "dev": true, "optional": true, "requires": { - "assert-plus": "^0.2.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" + "minimatch": "^3.0.4" } }, "inflight": { "version": "1.0.6", "bundled": true, "dev": true, + "optional": true, "requires": { "once": "^1.3.0", "wrappy": "1" @@ -3921,7 +3714,7 @@ "dev": true }, "ini": { - "version": "1.3.4", + "version": "1.3.5", "bundled": true, "dev": true, "optional": true @@ -3934,111 +3727,43 @@ "number-is-nan": "^1.0.0" } }, - "is-typedarray": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "optional": true - }, "isarray": { "version": "1.0.0", "bundled": true, - "dev": true - }, - "isstream": { - "version": "0.1.2", - "bundled": true, - "dev": true, - "optional": true - }, - "jodid25519": { - "version": "1.0.2", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "jsbn": "~0.1.0" - } - }, - "jsbn": { - "version": "0.1.1", - "bundled": true, - "dev": true, - "optional": true - }, - "json-schema": { - "version": "0.2.3", - "bundled": true, "dev": true, "optional": true }, - "json-stable-stringify": { - "version": "1.0.1", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "jsonify": "~0.0.0" - } - }, - "json-stringify-safe": { - "version": "5.0.1", - "bundled": true, - "dev": true, - "optional": true - }, - "jsonify": { - "version": "0.0.0", - "bundled": true, - "dev": true, - "optional": true - }, - "jsprim": { - "version": "1.4.0", + "minimatch": { + "version": "3.0.4", "bundled": true, "dev": true, - "optional": true, "requires": { - "assert-plus": "1.0.0", - "extsprintf": "1.0.2", - "json-schema": "0.2.3", - "verror": "1.3.6" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "optional": true - } + "brace-expansion": "^1.1.7" } }, - "mime-db": { - "version": "1.27.0", + "minimist": { + "version": "0.0.8", "bundled": true, "dev": true }, - "mime-types": { - "version": "2.1.15", + "minipass": { + "version": "2.3.5", "bundled": true, "dev": true, "requires": { - "mime-db": "~1.27.0" + "safe-buffer": "^5.1.2", + "yallist": "^3.0.0" } }, - "minimatch": { - "version": "3.0.4", + "minizlib": { + "version": "1.2.1", "bundled": true, "dev": true, + "optional": true, "requires": { - "brace-expansion": "^1.1.7" + "minipass": "^2.2.1" } }, - "minimist": { - "version": "0.0.8", - "bundled": true, - "dev": true - }, "mkdirp": { "version": "0.5.1", "bundled": true, @@ -4053,23 +3778,33 @@ "dev": true, "optional": true }, + "needle": { + "version": "2.2.4", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "debug": "^2.1.2", + "iconv-lite": "^0.4.4", + "sax": "^1.2.4" + } + }, "node-pre-gyp": { - "version": "0.6.39", + "version": "0.10.3", "bundled": true, "dev": true, "optional": true, "requires": { "detect-libc": "^1.0.2", - "hawk": "3.1.3", "mkdirp": "^0.5.1", + "needle": "^2.2.1", "nopt": "^4.0.1", + "npm-packlist": "^1.1.6", "npmlog": "^4.0.2", - "rc": "^1.1.7", - "request": "2.81.0", + "rc": "^1.2.7", "rimraf": "^2.6.1", "semver": "^5.3.0", - "tar": "^2.2.1", - "tar-pack": "^3.4.0" + "tar": "^4" } }, "nopt": { @@ -4082,8 +3817,24 @@ "osenv": "^0.1.4" } }, + "npm-bundled": { + "version": "1.0.5", + "bundled": true, + "dev": true, + "optional": true + }, + "npm-packlist": { + "version": "1.2.0", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "ignore-walk": "^3.0.1", + "npm-bundled": "^1.0.1" + } + }, "npmlog": { - "version": "4.1.0", + "version": "4.1.2", "bundled": true, "dev": true, "optional": true, @@ -4099,12 +3850,6 @@ "bundled": true, "dev": true }, - "oauth-sign": { - "version": "0.8.2", - "bundled": true, - "dev": true, - "optional": true - }, "object-assign": { "version": "4.1.1", "bundled": true, @@ -4132,7 +3877,7 @@ "optional": true }, "osenv": { - "version": "0.1.4", + "version": "0.1.5", "bundled": true, "dev": true, "optional": true, @@ -4144,38 +3889,22 @@ "path-is-absolute": { "version": "1.0.1", "bundled": true, - "dev": true - }, - "performance-now": { - "version": "0.2.0", - "bundled": true, "dev": true, "optional": true }, "process-nextick-args": { - "version": "1.0.7", - "bundled": true, - "dev": true - }, - "punycode": { - "version": "1.4.1", - "bundled": true, - "dev": true, - "optional": true - }, - "qs": { - "version": "6.4.0", + "version": "2.0.0", "bundled": true, "dev": true, "optional": true }, "rc": { - "version": "1.2.1", + "version": "1.2.8", "bundled": true, "dev": true, "optional": true, "requires": { - "deep-extend": "~0.4.0", + "deep-extend": "^0.6.0", "ini": "~1.3.0", "minimist": "^1.2.0", "strip-json-comments": "~2.0.1" @@ -4190,112 +3919,63 @@ } }, "readable-stream": { - "version": "2.2.9", + "version": "2.3.6", "bundled": true, "dev": true, + "optional": true, "requires": { - "buffer-shims": "~1.0.0", "core-util-is": "~1.0.0", - "inherits": "~2.0.1", + "inherits": "~2.0.3", "isarray": "~1.0.0", - "process-nextick-args": "~1.0.6", - "string_decoder": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", "util-deprecate": "~1.0.1" } }, - "request": { - "version": "2.81.0", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "aws-sign2": "~0.6.0", - "aws4": "^1.2.1", - "caseless": "~0.12.0", - "combined-stream": "~1.0.5", - "extend": "~3.0.0", - "forever-agent": "~0.6.1", - "form-data": "~2.1.1", - "har-validator": "~4.2.1", - "hawk": "~3.1.3", - "http-signature": "~1.1.0", - "is-typedarray": "~1.0.0", - "isstream": "~0.1.2", - "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.7", - "oauth-sign": "~0.8.1", - "performance-now": "^0.2.0", - "qs": "~6.4.0", - "safe-buffer": "^5.0.1", - "stringstream": "~0.0.4", - "tough-cookie": "~2.3.0", - "tunnel-agent": "^0.6.0", - "uuid": "^3.0.0" - } - }, "rimraf": { - "version": "2.6.1", + "version": "2.6.3", "bundled": true, "dev": true, + "optional": true, "requires": { - "glob": "^7.0.5" + "glob": "^7.1.3" } }, "safe-buffer": { - "version": "5.0.1", + "version": "5.1.2", "bundled": true, "dev": true }, - "semver": { - "version": "5.3.0", + "safer-buffer": { + "version": "2.1.2", "bundled": true, "dev": true, "optional": true }, - "set-blocking": { - "version": "2.0.0", + "sax": { + "version": "1.2.4", "bundled": true, "dev": true, "optional": true }, - "signal-exit": { - "version": "3.0.2", + "semver": { + "version": "5.6.0", "bundled": true, "dev": true, "optional": true }, - "sntp": { - "version": "1.0.9", + "set-blocking": { + "version": "2.0.0", "bundled": true, "dev": true, - "requires": { - "hoek": "2.x.x" - } + "optional": true }, - "sshpk": { - "version": "1.13.0", + "signal-exit": { + "version": "3.0.2", "bundled": true, "dev": true, - "optional": true, - "requires": { - "asn1": "~0.2.3", - "assert-plus": "^1.0.0", - "bcrypt-pbkdf": "^1.0.0", - "dashdash": "^1.12.0", - "ecc-jsbn": "~0.1.1", - "getpass": "^0.1.1", - "jodid25519": "^1.0.0", - "jsbn": "~0.1.0", - "tweetnacl": "~0.14.0" - }, - "dependencies": { - "assert-plus": { - "version": "1.0.0", - "bundled": true, - "dev": true, - "optional": true - } - } + "optional": true }, "string-width": { "version": "1.0.2", @@ -4308,19 +3988,14 @@ } }, "string_decoder": { - "version": "1.0.1", + "version": "1.1.1", "bundled": true, "dev": true, + "optional": true, "requires": { - "safe-buffer": "^5.0.1" + "safe-buffer": "~5.1.0" } }, - "stringstream": { - "version": "0.0.5", - "bundled": true, - "dev": true, - "optional": true - }, "strip-ansi": { "version": "3.0.1", "bundled": true, @@ -4336,94 +4011,44 @@ "optional": true }, "tar": { - "version": "2.2.1", - "bundled": true, - "dev": true, - "requires": { - "block-stream": "*", - "fstream": "^1.0.2", - "inherits": "2" - } - }, - "tar-pack": { - "version": "3.4.0", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "debug": "^2.2.0", - "fstream": "^1.0.10", - "fstream-ignore": "^1.0.5", - "once": "^1.3.3", - "readable-stream": "^2.1.4", - "rimraf": "^2.5.1", - "tar": "^2.2.1", - "uid-number": "^0.0.6" - } - }, - "tough-cookie": { - "version": "2.3.2", + "version": "4.4.8", "bundled": true, "dev": true, "optional": true, "requires": { - "punycode": "^1.4.1" + "chownr": "^1.1.1", + "fs-minipass": "^1.2.5", + "minipass": "^2.3.4", + "minizlib": "^1.1.1", + "mkdirp": "^0.5.0", + "safe-buffer": "^5.1.2", + "yallist": "^3.0.2" } }, - "tunnel-agent": { - "version": "0.6.0", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "safe-buffer": "^5.0.1" - } - }, - "tweetnacl": { - "version": "0.14.5", - "bundled": true, - "dev": true, - "optional": true - }, - "uid-number": { - "version": "0.0.6", - "bundled": true, - "dev": true, - "optional": true - }, "util-deprecate": { "version": "1.0.2", "bundled": true, - "dev": true - }, - "uuid": { - "version": "3.0.1", - "bundled": true, "dev": true, "optional": true }, - "verror": { - "version": "1.3.6", - "bundled": true, - "dev": true, - "optional": true, - "requires": { - "extsprintf": "1.0.2" - } - }, "wide-align": { - "version": "1.1.2", + "version": "1.1.3", "bundled": true, "dev": true, "optional": true, "requires": { - "string-width": "^1.0.2" + "string-width": "^1.0.2 || 2" } }, "wrappy": { "version": "1.0.2", "bundled": true, "dev": true + }, + "yallist": { + "version": "3.0.3", + "bundled": true, + "dev": true } } }, @@ -5789,9 +5414,9 @@ } }, "macaddress": { - "version": "0.2.8", - "resolved": "https://registry.npmjs.org/macaddress/-/macaddress-0.2.8.tgz", - "integrity": "sha1-WQTcU3w57G2+/q6QIycTX6hRHxI=", + "version": "0.2.9", + "resolved": "https://registry.npmjs.org/macaddress/-/macaddress-0.2.9.tgz", + "integrity": "sha512-k4F1JUof6cQXxNFzx3thLby4oJzXTXQueAOOts944Vqizn+Rjc2QNFenT9FJSLU1CH3PmrHRSyZs2E+Cqw+P2w==", "dev": true }, "map-cache": { @@ -5821,6 +5446,12 @@ "integrity": "sha1-3oGf282E3M2PrlnGrreWFbnSZqw=", "dev": true }, + "math-random": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/math-random/-/math-random-1.0.4.tgz", + "integrity": "sha512-rUxjysqif/BZQH2yhd5Aaq7vXMSx9NdEsQcyA07uEzIvxgI7zIr33gGsh+RU0/XjmQpCW7RsVof1vlkvQVCK5A==", + "dev": true + }, "md5.js": { "version": "1.3.4", "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.4.tgz", @@ -6239,9 +5870,9 @@ "integrity": "sha512-FiaFwKl864onHFFUV/a2szAl7X0fxVlSKNdhTf+BM8i8goEgYut8u5P9MqQqIYwvaMxjzVESsoEm/2kfkFH1rg==" }, "nan": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.8.0.tgz", - "integrity": "sha1-7XFfP+neArV6XmJS2QqWZ14fCFo=", + "version": "2.12.1", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.12.1.tgz", + "integrity": "sha512-JY7V6lRkStKcKTvHO5NVSQRv+RV+FIL5pvDoLiAtSL9pKlC5x9PKQcZDsq7m4FO4d57mkhC6Z+QhAh3Jdk5JFw==", "dev": true, "optional": true }, @@ -7688,43 +7319,27 @@ "dev": true }, "randomatic": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-1.1.7.tgz", - "integrity": "sha512-D5JUjPyJbaJDkuAazpVnSfVkLlpeO3wDlPROTMLGKG1zMFNFRgrciKo1ltz/AzNTkqE0HzDx655QOL51N06how==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-3.1.1.tgz", + "integrity": "sha512-TuDE5KxZ0J461RVjrJZCJc+J+zCkTb1MbH9AQUq68sMhOMcy9jLcb3BrZKgp9q9Ncltdg4QVqWrH02W2EFFVYw==", "dev": true, "requires": { - "is-number": "^3.0.0", - "kind-of": "^4.0.0" + "is-number": "^4.0.0", + "kind-of": "^6.0.0", + "math-random": "^1.0.1" }, "dependencies": { "is-number": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", - "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-4.0.0.tgz", + "integrity": "sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ==", + "dev": true }, "kind-of": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", - "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true } } }, @@ -10356,7 +9971,8 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", @@ -10381,7 +9997,8 @@ "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", @@ -11172,4 +10789,4 @@ } } } -} \ No newline at end of file +} diff --git a/server/routes/ticketAlloc.js b/server/routes/ticketAlloc.js new file mode 100644 index 00000000..8940f061 --- /dev/null +++ b/server/routes/ticketAlloc.js @@ -0,0 +1,70 @@ +const express = require('express'); +const router = express.Router(); +const co = require('co'); +const consts = require('../utils/consts'); +const JWT_KEY = process.env.JWT_KEY; +const Round = require('../models/TicketsAllocByRound'); +const uuid = require('uuid/v1'); +const permissionsUtils = require('../utils/permissions'); + +router.get('/rounds', co.wrap(function* (req, res) { + if (!permissionsUtils.isAdmin(req.userDetails)) { + return res.status(403).json([{"error": "Action is not allowed - User doesn't have admin permissions"}]); + } + + + const rounds = yield Round.find({}); + + return res.json(rounds); +})); + +router.post('/rounds/:eventId', co.wrap(function* (req, res) { + // if (!permissionsUtils.isAdmin(req.userDetails)) { + // return res.status(403).json([{"error": "Action is not allowed - User doesn't have admin permissions"}]); + // } + + // const round = new Round({ + // _id: roundId, + // eventId: 'MIDBURN2019', + // startDate: new Date('January 06, 2019 00:00:00'), + // endDate: new Date('February 11, 2019 00:00:00'), + // based_event_id: 'MIDBURN2019', + // is_show: true, + // description: 'כרטיסים למתנדבים חדשים'|| '' + // }); + const eventId = req.params.eventId; + const roundId = uuid() + const round = new Round({ + _id: roundId, + eventId, + startDate: req.startDate, + endDate: req.endDate, + based_event_id: req.based_event_id, + is_show: req.is_show, + description: req.description || '' + }); + + yield round.save(); + return res.json(round); +})); + + + +// router.post('/events/change', co.wrap(function*(req, res) { +// const new_event = req.body.event; +// if (!consts.SUPPORTED_EVENTS.includes(new_event)){ +// res.status(404).json({error: `Event ${new_event} does not exist`}); +// return +// } + +// if (new_event == req.userDetails.eventId) { +// res.json('OK') +// return +// } +// const cookie = req.cookies[JWT_KEY] +// cookie.currentEventId = new_event +// const options = process.env.LOCAL_SPARK === 'true' ? { httpOnly: true } : { httpOnly: true, domain: '.midburn.org' } +// res.cookie(JWT_KEY, cookie, options).json(cookie) +// })); + +module.exports = router; \ No newline at end of file diff --git a/server/server.js b/server/server.js index dae81eba..b585b950 100644 --- a/server/server.js +++ b/server/server.js @@ -76,6 +76,7 @@ app.use('/api/v1', require('./routes/volunteerRequests')); app.use('/api/v1', require('./routes/permissions')); app.use('/api/v1', require('./routes/departmentForms')); app.use('/api/v1', require('./routes/reports')); +app.use('/api/v1', require('./routes/ticketAlloc')); app.use('/api/v1/verifyCookie', (req, res) => { let token = req.cookies && req.cookies[JWT_KEY] && req.cookies[JWT_KEY].token; From 82afcfda148361e98325711fda9296c4fb932acc Mon Sep 17 00:00:00 2001 From: markfridman Date: Sat, 19 Jan 2019 16:28:55 +0200 Subject: [PATCH 2/4] last row fix --- server/routes/ticketAlloc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/routes/ticketAlloc.js b/server/routes/ticketAlloc.js index 8940f061..64470827 100644 --- a/server/routes/ticketAlloc.js +++ b/server/routes/ticketAlloc.js @@ -67,4 +67,4 @@ router.post('/rounds/:eventId', co.wrap(function* (req, res) { // res.cookie(JWT_KEY, cookie, options).json(cookie) // })); -module.exports = router; \ No newline at end of file +module.exports = router; From eaa7c2180cb00fd099da458da6607e9b09428f88 Mon Sep 17 00:00:00 2001 From: markfridman Date: Sat, 19 Jan 2019 17:20:32 +0200 Subject: [PATCH 3/4] added get to active round --- server/routes/ticketAlloc.js | 57 +++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 24 deletions(-) diff --git a/server/routes/ticketAlloc.js b/server/routes/ticketAlloc.js index 64470827..2ad07520 100644 --- a/server/routes/ticketAlloc.js +++ b/server/routes/ticketAlloc.js @@ -9,41 +9,50 @@ const permissionsUtils = require('../utils/permissions'); router.get('/rounds', co.wrap(function* (req, res) { if (!permissionsUtils.isAdmin(req.userDetails)) { - return res.status(403).json([{"error": "Action is not allowed - User doesn't have admin permissions"}]); + return res.status(403).json([{ "error": "Action is not allowed - User doesn't have admin permissions" }]); } - const rounds = yield Round.find({}); return res.json(rounds); })); +router.get('/rounds/active', co.wrap(function* (req, res) { + if (!permissionsUtils.isAdmin(req.userDetails)) { + return res.status(403).json([{ "error": "Action is not allowed - User doesn't have admin permissions" }]); + } + + const round = yield Round.findOne({ is_show: true }); + + return res.json(round); +})); + router.post('/rounds/:eventId', co.wrap(function* (req, res) { // if (!permissionsUtils.isAdmin(req.userDetails)) { // return res.status(403).json([{"error": "Action is not allowed - User doesn't have admin permissions"}]); // } - + // const round = new Round({ - // _id: roundId, - // eventId: 'MIDBURN2019', - // startDate: new Date('January 06, 2019 00:00:00'), - // endDate: new Date('February 11, 2019 00:00:00'), - // based_event_id: 'MIDBURN2019', - // is_show: true, - // description: 'כרטיסים למתנדבים חדשים'|| '' - // }); - const eventId = req.params.eventId; - const roundId = uuid() - const round = new Round({ - _id: roundId, - eventId, - startDate: req.startDate, - endDate: req.endDate, - based_event_id: req.based_event_id, - is_show: req.is_show, - description: req.description || '' - }); - + // _id: roundId, + // eventId: 'MIDBURN2019', + // startDate: new Date('January 06, 2019 00:00:00'), + // endDate: new Date('February 11, 2019 00:00:00'), + // based_event_id: 'MIDBURN2019', + // is_show: true, + // description: 'כרטיסים למתנדבים חדשים'|| '' + // }); + const eventId = req.params.eventId; + const roundId = uuid() + const round = new Round({ + _id: roundId, + eventId, + startDate: req.startDate, + endDate: req.endDate, + based_event_id: req.based_event_id, + is_show: req.is_show, + description: req.description || '' + }); + yield round.save(); return res.json(round); })); @@ -56,7 +65,7 @@ router.post('/rounds/:eventId', co.wrap(function* (req, res) { // res.status(404).json({error: `Event ${new_event} does not exist`}); // return // } - + // if (new_event == req.userDetails.eventId) { // res.json('OK') // return From 0383ce92b5827e99963089ac35a633eae80d76ae Mon Sep 17 00:00:00 2001 From: Mark Fridman Date: Tue, 22 Jan 2019 09:59:34 +0200 Subject: [PATCH 4/4] removed _id and comments --- server/routes/ticketAlloc.js | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/server/routes/ticketAlloc.js b/server/routes/ticketAlloc.js index 2ad07520..f920c812 100644 --- a/server/routes/ticketAlloc.js +++ b/server/routes/ticketAlloc.js @@ -1,7 +1,6 @@ const express = require('express'); const router = express.Router(); const co = require('co'); -const consts = require('../utils/consts'); const JWT_KEY = process.env.JWT_KEY; const Round = require('../models/TicketsAllocByRound'); const uuid = require('uuid/v1'); @@ -32,19 +31,8 @@ router.post('/rounds/:eventId', co.wrap(function* (req, res) { // return res.status(403).json([{"error": "Action is not allowed - User doesn't have admin permissions"}]); // } - // const round = new Round({ - // _id: roundId, - // eventId: 'MIDBURN2019', - // startDate: new Date('January 06, 2019 00:00:00'), - // endDate: new Date('February 11, 2019 00:00:00'), - // based_event_id: 'MIDBURN2019', - // is_show: true, - // description: 'כרטיסים למתנדבים חדשים'|| '' - // }); const eventId = req.params.eventId; - const roundId = uuid() const round = new Round({ - _id: roundId, eventId, startDate: req.startDate, endDate: req.endDate, @@ -57,8 +45,6 @@ router.post('/rounds/:eventId', co.wrap(function* (req, res) { return res.json(round); })); - - // router.post('/events/change', co.wrap(function*(req, res) { // const new_event = req.body.event; // if (!consts.SUPPORTED_EVENTS.includes(new_event)){