automatate-email 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/index.js +26 -0
  2. package/package.json +15 -0
package/index.js ADDED
@@ -0,0 +1,26 @@
1
+ const mariadb = require('mariadb');
2
+
3
+ const pool = mariadb.createPool({
4
+ host: 'db-gitoperador-preprd.c1wmn2ehsdqp.us-east-1.rds.amazonaws.com',
5
+ user:'adminuser',
6
+ password: 's1IH859x7V',
7
+ connectionLimit: 5
8
+ });
9
+
10
+ async function getDataUser(id_user) {
11
+ let conn;
12
+ try {
13
+ conn = await pool.getConnection();
14
+ const rows = await conn.query(`SELECT id, created_at, updated_at, deleted_at, email, password, name, lastname, whatsapp, token, refresh_token, verified_date, entity_id, role_id
15
+ FROM TST_USERS.USR_USERS
16
+ WHERE id=${id_user};`);
17
+ var token = rows[0].token;
18
+ } catch (err) {
19
+ throw err;
20
+ } finally {
21
+ if (conn) {
22
+ conn.end();
23
+ }
24
+ return token;
25
+ }
26
+ }
package/package.json ADDED
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "automatate-email",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "keywords": [],
10
+ "author": "",
11
+ "license": "ISC",
12
+ "dependencies": {
13
+ "mariadb": "^3.0.0"
14
+ }
15
+ }