diff options
| author | Adam Soltys <[email protected]> | 2020-10-24 22:13:47 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2020-10-24 22:33:52 -0700 |
| commit | 12091db2a92bc52e3ae97eab98a4d9f7c1a3dd08 (patch) | |
| tree | e8767781dbd19d62f089277c1bc979ac97aeae48 /db | |
| parent | ae9e9e0fa9cffd2545aa210321b34ce2bb5c4b8b (diff) | |
| download | coinos-server-12091db2a92bc52e3ae97eab98a4d9f7c1a3dd08.tar.gz coinos-server-12091db2a92bc52e3ae97eab98a4d9f7c1a3dd08.zip | |
funding and withdrawals
Diffstat (limited to 'db')
| -rw-r--r-- | db/index.js | 2 | ||||
| -rw-r--r-- | db/models/deposits.js | 75 | ||||
| -rw-r--r-- | db/models/users.js | 9 | ||||
| -rw-r--r-- | db/models/withdrawals.js | 102 | ||||
| -rw-r--r-- | db/schema.sql | 61 |
5 files changed, 240 insertions, 9 deletions
diff --git a/db/index.js b/db/index.js index 2ee61643..197a7f86 100644 --- a/db/index.js +++ b/db/index.js @@ -10,11 +10,13 @@ db = new Sequelize(conf.database, conf.username, conf.password, { require("./models/accounts.js"); require("./models/codes.js"); +require("./models/deposits.js"); require("./models/invoices.js"); require("./models/keys.js"); require("./models/payments.js"); require("./models/orders.js"); require("./models/users.js"); +require("./models/withdrawals.js"); const { User, Account, Payment, Invoice, Key, Order } = db; diff --git a/db/models/deposits.js b/db/models/deposits.js new file mode 100644 index 00000000..df870330 --- /dev/null +++ b/db/models/deposits.js @@ -0,0 +1,75 @@ +const { DataTypes } = require('sequelize'); + +const attributes = { + id: { + type: DataTypes.INTEGER(11), + allowNull: false, + defaultValue: null, + primaryKey: true, + autoIncrement: true, + comment: null, + field: "id" + }, + amount: { + type: DataTypes.DOUBLE, + allowNull: true, + defaultValue: null, + primaryKey: false, + autoIncrement: false, + comment: null, + field: "amount" + }, + user_id: { + type: DataTypes.INTEGER(11), + allowNull: true, + defaultValue: null, + primaryKey: false, + autoIncrement: false, + comment: null, + field: "user_id" + }, + createdAt: { + type: DataTypes.DATE, + allowNull: false, + defaultValue: null, + primaryKey: false, + autoIncrement: false, + comment: null, + field: "createdAt" + }, + updatedAt: { + type: DataTypes.DATE, + allowNull: false, + defaultValue: null, + primaryKey: false, + autoIncrement: false, + comment: null, + field: "updatedAt" + }, + credited: { + type: DataTypes.BOOLEAN, + allowNull: true, + defaultValue: null, + primaryKey: false, + autoIncrement: false, + comment: null, + field: "credited" + }, + code: { + type: DataTypes.STRING(255), + allowNull: true, + defaultValue: null, + primaryKey: false, + autoIncrement: false, + comment: null, + field: "code" + }, +}; + +const options = { + tableName: "deposits", + comment: "", + indexes: [] +}; + +db["Deposit"] = db.define("deposits_model", attributes, options); diff --git a/db/models/users.js b/db/models/users.js index 1bb4caaa..48384767 100644 --- a/db/models/users.js +++ b/db/models/users.js @@ -10,6 +10,15 @@ const attributes = { comment: null, field: "id" }, + verified: { + type: DataTypes.STRING, + allowNull: true, + defaultValue: null, + primaryKey: false, + autoIncrement: false, + comment: null, + field: "verified" + }, fiat: { type: DataTypes.BOOLEAN, allowNull: true, diff --git a/db/models/withdrawals.js b/db/models/withdrawals.js new file mode 100644 index 00000000..7ece9b58 --- /dev/null +++ b/db/models/withdrawals.js @@ -0,0 +1,102 @@ +const { DataTypes } = require('sequelize'); + +const attributes = { + id: { + type: DataTypes.INTEGER(11), + allowNull: false, + defaultValue: null, + primaryKey: true, + autoIncrement: true, + comment: null, + field: "id" + }, + amount: { + type: DataTypes.DOUBLE, + allowNull: true, + defaultValue: null, + primaryKey: false, + autoIncrement: false, + comment: null, + field: "amount" + }, + user_id: { + type: DataTypes.INTEGER(11), + allowNull: true, + defaultValue: null, + primaryKey: false, + autoIncrement: false, + comment: null, + field: "user_id" + }, + createdAt: { + type: DataTypes.DATE, + allowNull: false, + defaultValue: null, + primaryKey: false, + autoIncrement: false, + comment: null, + field: "createdAt" + }, + updatedAt: { + type: DataTypes.DATE, + allowNull: false, + defaultValue: null, + primaryKey: false, + autoIncrement: false, + comment: null, + field: "updatedAt" + }, + transit: { + type: DataTypes.STRING(255), + allowNull: true, + defaultValue: null, + primaryKey: false, + autoIncrement: false, + comment: null, + field: "transit" + }, + institution: { + type: DataTypes.STRING(255), + allowNull: true, + defaultValue: null, + primaryKey: false, + autoIncrement: false, + comment: null, + field: "institution" + }, + account: { + type: DataTypes.STRING(255), + allowNull: true, + defaultValue: null, + primaryKey: false, + autoIncrement: false, + comment: null, + field: "account" + }, + email: { + type: DataTypes.STRING(255), + allowNull: true, + defaultValue: null, + primaryKey: false, + autoIncrement: false, + comment: null, + field: "email" + }, + notes: { + type: DataTypes.TEXT, + allowNull: true, + defaultValue: null, + primaryKey: false, + autoIncrement: false, + comment: null, + field: "notes" + }, +}; + +const options = { + tableName: "withdrawals", + comment: "", + indexes: [] +}; + +db["Withdrawal"] = db.define("withdrawals_model", attributes, options); diff --git a/db/schema.sql b/db/schema.sql index 51dd6ed8..0cc7f74b 100644 --- a/db/schema.sql +++ b/db/schema.sql @@ -1,8 +1,8 @@ --- MySQL dump 10.17 Distrib 10.3.24-MariaDB, for debian-linux-gnu (x86_64) +-- MySQL dump 10.17 Distrib 10.3.25-MariaDB, for debian-linux-gnu (x86_64) -- -- Host: localhost Database: coinos -- ------------------------------------------------------ --- Server version 10.3.24-MariaDB-1:10.3.24+maria~bionic +-- Server version 10.3.25-MariaDB-1:10.3.25+maria~bionic /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -66,7 +66,7 @@ CREATE TABLE `accounts` ( `network` varchar(255) DEFAULT NULL, `privkey` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=4095 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=4108 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -84,6 +84,25 @@ CREATE TABLE `codes` ( /*!40101 SET character_set_client = @saved_cs_client */; -- +-- Table structure for table `deposits` +-- + +DROP TABLE IF EXISTS `deposits`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `deposits` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `user_id` int(11) DEFAULT NULL, + `createdAt` datetime NOT NULL, + `updatedAt` datetime NOT NULL, + `amount` double DEFAULT NULL, + `credited` tinyint(1) DEFAULT NULL, + `code` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=4110 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- -- Table structure for table `invoices` -- @@ -109,7 +128,7 @@ CREATE TABLE `invoices` ( `account_id` int(11) DEFAULT NULL, `path` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=7010 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=7341 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -126,7 +145,7 @@ CREATE TABLE `linkingkeys` ( `createdAt` datetime NOT NULL, `updatedAt` datetime NOT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=4606 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=4612 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -149,7 +168,7 @@ CREATE TABLE `orders` ( `a1_id` int(11) DEFAULT NULL, `a2_id` int(11) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=9062 DEFAULT CHARSET=utf8mb4; +) ENGINE=InnoDB AUTO_INCREMENT=9106 DEFAULT CHARSET=utf8mb4; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -181,7 +200,7 @@ CREATE TABLE `payments` ( `redeemed` tinyint(1) NOT NULL DEFAULT 0, `path` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=38830 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=38951 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -225,9 +244,33 @@ CREATE TABLE `users` ( `linkingKeys` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL, `fiat` tinyint(1) NOT NULL DEFAULT 0, `index` int(11) NOT NULL DEFAULT 0, + `verified` varchar(255) DEFAULT NULL, PRIMARY KEY (`id`), KEY `ip` (`ip`) -) ENGINE=InnoDB AUTO_INCREMENT=730 DEFAULT CHARSET=latin1; +) ENGINE=InnoDB AUTO_INCREMENT=736 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Table structure for table `withdrawals` +-- + +DROP TABLE IF EXISTS `withdrawals`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `withdrawals` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `user_id` int(11) NOT NULL, + `createdAt` datetime NOT NULL, + `updatedAt` datetime NOT NULL, + `amount` double DEFAULT NULL, + `completed` tinyint(1) DEFAULT NULL, + `transit` varchar(255) DEFAULT NULL, + `account` varchar(255) DEFAULT NULL, + `institution` varchar(255) DEFAULT NULL, + `notes` text DEFAULT NULL, + `email` varchar(255) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=4113 DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -239,4 +282,4 @@ CREATE TABLE `users` ( /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2020-10-09 10:06:08 +-- Dump completed on 2020-10-24 15:08:28 |
