From 8e2f46cbee98e6736c51f0e5336eac68a727846e Mon Sep 17 00:00:00 2001 From: jamiebones Date: Tue, 20 Apr 2021 09:05:17 +0100 Subject: [PATCH] change sms to priority route --- client/src/globalStyles.js | 2 +- server/logs/app.log | 2 ++ server/src/config/isAuth.js | 3 ++- server/src/config/redis-client.js | 26 +++++++++---------- .../confirmPhoneTable/confirmPhoneNumber.js | 2 +- server/src/methods/message/cheapGlobalSMS.js | 2 +- .../methods/studentBio/confirmStudentShip.js | 2 ++ server/src/modules/init.js | 2 +- 8 files changed, 23 insertions(+), 18 deletions(-) diff --git a/client/src/globalStyles.js b/client/src/globalStyles.js index b20b91aa..d95567bb 100644 --- a/client/src/globalStyles.js +++ b/client/src/globalStyles.js @@ -13,4 +13,4 @@ const GlobalStyle = createGlobalStyle` } `; -export default GlobalStyle; \ No newline at end of file +export default GlobalStyle; diff --git a/server/logs/app.log b/server/logs/app.log index 1730bc56..ae9d9578 100644 --- a/server/logs/app.log +++ b/server/logs/app.log @@ -638,3 +638,5 @@ {"error":{"code":"EADDRINUSE","errno":"EADDRINUSE","syscall":"listen","address":"::","port":8000},"level":"error","message":"uncaughtException: listen EADDRINUSE: address already in use :::8000\nError: listen EADDRINUSE: address already in use :::8000\n at Server.setupListenHandle [as _listen2] (net.js:1316:16)\n at listenInCluster (net.js:1364:12)\n at Server.listen (net.js:1450:7)\n at StartUp (/usr/app/src/index.js:111:14)\n at processTicksAndRejections (internal/process/task_queues.js:97:5)","stack":"Error: listen EADDRINUSE: address already in use :::8000\n at Server.setupListenHandle [as _listen2] (net.js:1316:16)\n at listenInCluster (net.js:1364:12)\n at Server.listen (net.js:1450:7)\n at StartUp (/usr/app/src/index.js:111:14)\n at processTicksAndRejections (internal/process/task_queues.js:97:5)","exception":true,"date":"Sun Mar 28 2021 18:50:12 GMT+0000 (Coordinated Universal Time)","process":{"pid":2378,"uid":0,"gid":0,"cwd":"/usr/app","execPath":"/usr/local/bin/node","version":"v12.20.1","argv":["node","/usr/app/src/index.js"],"memoryUsage":{"rss":565899264,"heapTotal":412860416,"heapUsed":309370440,"external":20574680,"arrayBuffers":18507461}},"os":{"loadavg":[5.52,4.21,3.48],"uptime":467755},"trace":[{"column":16,"file":"net.js","function":"Server.setupListenHandle [as _listen2]","line":1316,"method":"setupListenHandle [as _listen2]","native":false},{"column":12,"file":"net.js","function":"listenInCluster","line":1364,"method":null,"native":false},{"column":7,"file":"net.js","function":"Server.listen","line":1450,"method":"listen","native":false},{"column":14,"file":"/usr/app/src/index.js","function":"StartUp","line":111,"method":null,"native":false},{"column":5,"file":"internal/process/task_queues.js","function":"processTicksAndRejections","line":97,"method":null,"native":false}]} {"error":{"code":"EADDRINUSE","errno":"EADDRINUSE","syscall":"listen","address":"::","port":8000},"level":"error","message":"uncaughtException: listen EADDRINUSE: address already in use :::8000\nError: listen EADDRINUSE: address already in use :::8000\n at Server.setupListenHandle [as _listen2] (net.js:1316:16)\n at listenInCluster (net.js:1364:12)\n at Server.listen (net.js:1450:7)\n at StartUp (/usr/app/src/index.js:111:14)\n at processTicksAndRejections (internal/process/task_queues.js:97:5)","stack":"Error: listen EADDRINUSE: address already in use :::8000\n at Server.setupListenHandle [as _listen2] (net.js:1316:16)\n at listenInCluster (net.js:1364:12)\n at Server.listen (net.js:1450:7)\n at StartUp (/usr/app/src/index.js:111:14)\n at processTicksAndRejections (internal/process/task_queues.js:97:5)","exception":true,"date":"Sun Mar 28 2021 18:55:52 GMT+0000 (Coordinated Universal Time)","process":{"pid":8686,"uid":0,"gid":0,"cwd":"/usr/app","execPath":"/usr/local/bin/node","version":"v12.20.1","argv":["node","/usr/app/src/index.js"],"memoryUsage":{"rss":1779183616,"heapTotal":1601847296,"heapUsed":1557823480,"external":47542903,"arrayBuffers":18515020}},"os":{"loadavg":[6.09,4.66,3.78],"uptime":468095},"trace":[{"column":16,"file":"net.js","function":"Server.setupListenHandle [as _listen2]","line":1316,"method":"setupListenHandle [as _listen2]","native":false},{"column":12,"file":"net.js","function":"listenInCluster","line":1364,"method":null,"native":false},{"column":7,"file":"net.js","function":"Server.listen","line":1450,"method":"listen","native":false},{"column":14,"file":"/usr/app/src/index.js","function":"StartUp","line":111,"method":null,"native":false},{"column":5,"file":"internal/process/task_queues.js","function":"processTicksAndRejections","line":97,"method":null,"native":false}]} {"error":{"errno":"ECONNREFUSED","code":"ECONNREFUSED","syscall":"connect","address":"192.168.0.3","port":6379},"level":"error","message":"uncaughtException: Redis connection to redis_cache:6379 failed - connect ECONNREFUSED 192.168.0.3:6379\nError: Redis connection to redis_cache:6379 failed - connect ECONNREFUSED 192.168.0.3:6379\n at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1144:16)","stack":"Error: Redis connection to redis_cache:6379 failed - connect ECONNREFUSED 192.168.0.3:6379\n at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1144:16)","exception":true,"date":"Mon Mar 29 2021 08:03:42 GMT+0000 (Coordinated Universal Time)","process":{"pid":62,"uid":0,"gid":0,"cwd":"/usr/app","execPath":"/usr/local/bin/node","version":"v12.20.1","argv":["node","/usr/app/src/index.js"],"memoryUsage":{"rss":440717312,"heapTotal":295014400,"heapUsed":292567848,"external":20597012,"arrayBuffers":18531081}},"os":{"loadavg":[4.08,3.65,3.39],"uptime":515366},"trace":[{"column":16,"file":"net.js","function":"TCPConnectWrap.afterConnect [as oncomplete]","line":1144,"method":"afterConnect [as oncomplete]","native":false}]} +{"error":{"code":"EADDRINUSE","errno":"EADDRINUSE","syscall":"listen","address":"::","port":8000},"level":"error","message":"uncaughtException: listen EADDRINUSE: address already in use :::8000\nError: listen EADDRINUSE: address already in use :::8000\n at Server.setupListenHandle [as _listen2] (net.js:1316:16)\n at listenInCluster (net.js:1364:12)\n at Server.listen (net.js:1450:7)\n at StartUp (/usr/app/src/index.js:111:14)\n at processTicksAndRejections (internal/process/task_queues.js:97:5)","stack":"Error: listen EADDRINUSE: address already in use :::8000\n at Server.setupListenHandle [as _listen2] (net.js:1316:16)\n at listenInCluster (net.js:1364:12)\n at Server.listen (net.js:1450:7)\n at StartUp (/usr/app/src/index.js:111:14)\n at processTicksAndRejections (internal/process/task_queues.js:97:5)","exception":true,"date":"Mon Apr 05 2021 17:32:51 GMT+0000 (Coordinated Universal Time)","process":{"pid":1117,"uid":0,"gid":0,"cwd":"/usr/app","execPath":"/usr/local/bin/node","version":"v12.20.1","argv":["node","/usr/app/src/index.js"],"memoryUsage":{"rss":671449088,"heapTotal":575016960,"heapUsed":518179488,"external":20575091,"arrayBuffers":18507872}},"os":{"loadavg":[3.24,3.45,3.62],"uptime":604097},"trace":[{"column":16,"file":"net.js","function":"Server.setupListenHandle [as _listen2]","line":1316,"method":"setupListenHandle [as _listen2]","native":false},{"column":12,"file":"net.js","function":"listenInCluster","line":1364,"method":null,"native":false},{"column":7,"file":"net.js","function":"Server.listen","line":1450,"method":"listen","native":false},{"column":14,"file":"/usr/app/src/index.js","function":"StartUp","line":111,"method":null,"native":false},{"column":5,"file":"internal/process/task_queues.js","function":"processTicksAndRejections","line":97,"method":null,"native":false}]} +{"error":{"code":"EADDRINUSE","errno":"EADDRINUSE","syscall":"listen","address":"::","port":8000},"level":"error","message":"uncaughtException: listen EADDRINUSE: address already in use :::8000\nError: listen EADDRINUSE: address already in use :::8000\n at Server.setupListenHandle [as _listen2] (net.js:1316:16)\n at listenInCluster (net.js:1364:12)\n at Server.listen (net.js:1450:7)\n at StartUp (/usr/app/src/index.js:111:14)\n at processTicksAndRejections (internal/process/task_queues.js:97:5)","stack":"Error: listen EADDRINUSE: address already in use :::8000\n at Server.setupListenHandle [as _listen2] (net.js:1316:16)\n at listenInCluster (net.js:1364:12)\n at Server.listen (net.js:1450:7)\n at StartUp (/usr/app/src/index.js:111:14)\n at processTicksAndRejections (internal/process/task_queues.js:97:5)","exception":true,"date":"Tue Apr 20 2021 08:00:26 GMT+0000 (Coordinated Universal Time)","process":{"pid":173,"uid":0,"gid":0,"cwd":"/usr/app","execPath":"/usr/local/bin/node","version":"v12.20.1","argv":["node","/usr/app/src/index.js"],"memoryUsage":{"rss":675323904,"heapTotal":565821440,"heapUsed":518385640,"external":20574047,"arrayBuffers":18506828}},"os":{"loadavg":[3.73,3.1,3.03],"uptime":435034},"trace":[{"column":16,"file":"net.js","function":"Server.setupListenHandle [as _listen2]","line":1316,"method":"setupListenHandle [as _listen2]","native":false},{"column":12,"file":"net.js","function":"listenInCluster","line":1364,"method":null,"native":false},{"column":7,"file":"net.js","function":"Server.listen","line":1450,"method":"listen","native":false},{"column":14,"file":"/usr/app/src/index.js","function":"StartUp","line":111,"method":null,"native":false},{"column":5,"file":"internal/process/task_queues.js","function":"processTicksAndRejections","line":97,"method":null,"native":false}]} diff --git a/server/src/config/isAuth.js b/server/src/config/isAuth.js index 2017d958..bb0dcd83 100644 --- a/server/src/config/isAuth.js +++ b/server/src/config/isAuth.js @@ -22,7 +22,7 @@ export default (req) => { if (!decodedToken) { return null; } - const { id, email, regNumber, accessLevel, active } = decodedToken; + const { id, email, regNumber, accessLevel, active, userType } = decodedToken; if (!active) { return null; @@ -34,5 +34,6 @@ export default (req) => { regNumber, accessLevel, active, + userType }; }; diff --git a/server/src/config/redis-client.js b/server/src/config/redis-client.js index 630686a3..1069a0ea 100644 --- a/server/src/config/redis-client.js +++ b/server/src/config/redis-client.js @@ -1,15 +1,15 @@ // redis-client.js -const redis = require("redis"); -const { promisify } = require("util"); -const client = redis.createClient(process.env.REDIS_URL); +// const redis = require("redis"); +// const { promisify } = require("util"); +// const client = redis.createClient(process.env.REDIS_URL); -export default { - ...client, - getAsync: promisify(client.get).bind(client), - delAsync: promisify(client.del).bind(client), - setAsync: promisify(client.set).bind(client), - keysAsync: promisify(client.keys).bind(client), - hmsetAsync:promisify(client.hmset).bind(client), - hgetallAsync:promisify(client.hgetall).bind(client), - hdelAsync:promisify(client.hdel).bind(client), -}; +// export default { +// ...client, +// getAsync: promisify(client.get).bind(client), +// delAsync: promisify(client.del).bind(client), +// setAsync: promisify(client.set).bind(client), +// keysAsync: promisify(client.keys).bind(client), +// hmsetAsync:promisify(client.hmset).bind(client), +// hgetallAsync:promisify(client.hgetall).bind(client), +// hdelAsync:promisify(client.hdel).bind(client), +// }; diff --git a/server/src/methods/confirmPhoneTable/confirmPhoneNumber.js b/server/src/methods/confirmPhoneTable/confirmPhoneNumber.js index 5262b826..6e9c2009 100644 --- a/server/src/methods/confirmPhoneTable/confirmPhoneNumber.js +++ b/server/src/methods/confirmPhoneTable/confirmPhoneNumber.js @@ -14,7 +14,7 @@ const _setCode = () => { export default async ({ number, regNumber, conn }) => { const code = _setCode(); - let msg = `your confirmation code is ${code}`; + let msg = `your confirmation digit is ${code}`; try { //await axios.post(api); diff --git a/server/src/methods/message/cheapGlobalSMS.js b/server/src/methods/message/cheapGlobalSMS.js index 5dafcae6..cff8ce5f 100644 --- a/server/src/methods/message/cheapGlobalSMS.js +++ b/server/src/methods/message/cheapGlobalSMS.js @@ -22,7 +22,7 @@ const checkSMSCredit = async () => { const sendMessage = async ({ receipents, sender, message }) => { const smsRequest = await axios.get( - `${CheapGlobalSmsGateway}?sub_account=${CheapGlobalSmsSubAccount}&sub_account_pass=${CheapGlobalSmsSubAccountPassword}&action=send_sms&sender_id=${sender}&message=${message}&recipients=${receipents}&type=0` + `${CheapGlobalSmsGateway}?sub_account=${CheapGlobalSmsSubAccount}&sub_account_pass=${CheapGlobalSmsSubAccountPassword}&action=send_sms&sender_id=${sender}&message=${message}&recipients=${receipents}&type=0&route=1` ); const response = smsRequest.data; diff --git a/server/src/methods/studentBio/confirmStudentShip.js b/server/src/methods/studentBio/confirmStudentShip.js index 349a427d..39db05f6 100644 --- a/server/src/methods/studentBio/confirmStudentShip.js +++ b/server/src/methods/studentBio/confirmStudentShip.js @@ -3,6 +3,8 @@ const { NODE_ENV } = process.env; export default (regNumber, conn) => { if (NODE_ENV === "development") { return _confirmStatusDevelopment(regNumber, conn); + } else{ + return _confirmStatusDevelopment(regNumber, conn); } }; diff --git a/server/src/modules/init.js b/server/src/modules/init.js index b1ce3108..5a31b9f1 100644 --- a/server/src/modules/init.js +++ b/server/src/modules/init.js @@ -30,7 +30,7 @@ class InitTask { email: "jamiebones147@gmail.com", password: hash, accessLevel: "super-admin", - userType: "staff", + userType: "super-admin", name: "James Oshomah", }; const adminUser = new models.User(admin);