diff options
| author | Adam Soltys <[email protected]> | 2020-03-11 15:10:40 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2020-03-11 15:10:40 -0700 |
| commit | c0888fab024cc9f7c99812bfabf9d7774312dbf7 (patch) | |
| tree | cad95683af97432f6092a2c2bae10fbb7a588db5 /db/models | |
| parent | bf2b51f0c2ae9b8f0f330dde6411e45fc0da8a25 (diff) | |
| download | coinos-server-c0888fab024cc9f7c99812bfabf9d7774312dbf7.tar.gz coinos-server-c0888fab024cc9f7c99812bfabf9d7774312dbf7.zip | |
refactor
Diffstat (limited to 'db/models')
| -rw-r--r-- | db/models/payments.js | 138 | ||||
| -rw-r--r-- | db/models/users.js | 246 |
2 files changed, 384 insertions, 0 deletions
diff --git a/db/models/payments.js b/db/models/payments.js new file mode 100644 index 00000000..c6dd6e83 --- /dev/null +++ b/db/models/payments.js @@ -0,0 +1,138 @@ +const { DataTypes } = require('sequelize'); + +const attributes = { + id: { + type: DataTypes.INTEGER(11), + allowNull: false, + defaultValue: null, + primaryKey: true, + autoIncrement: true, + comment: null, + field: "id" + }, + user_id: { + type: DataTypes.INTEGER(11), + allowNull: true, + defaultValue: null, + primaryKey: false, + autoIncrement: false, + comment: null, + field: "user_id" + }, + hash: { + type: DataTypes.TEXT, + allowNull: true, + defaultValue: null, + primaryKey: false, + autoIncrement: false, + comment: null, + field: "hash" + }, + 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" + }, + rate: { + type: DataTypes.DOUBLE, + allowNull: true, + defaultValue: null, + primaryKey: false, + autoIncrement: false, + comment: null, + field: "rate" + }, + asset: { + type: DataTypes.STRING(255), + allowNull: true, + defaultValue: null, + primaryKey: false, + autoIncrement: false, + comment: null, + field: "asset" + }, + currency: { + type: DataTypes.STRING(255), + allowNull: true, + defaultValue: null, + primaryKey: false, + autoIncrement: false, + comment: null, + field: "currency" + }, + address: { + type: DataTypes.STRING(255), + allowNull: true, + defaultValue: null, + primaryKey: false, + autoIncrement: false, + comment: null, + field: "address" + }, + received: { + type: DataTypes.INTEGER(1), + allowNull: true, + defaultValue: null, + primaryKey: false, + autoIncrement: false, + comment: null, + field: "received" + }, + amount: { + type: DataTypes.DOUBLE, + allowNull: true, + defaultValue: null, + primaryKey: false, + autoIncrement: false, + comment: null, + field: "amount" + }, + fee: { + type: DataTypes.DOUBLE, + allowNull: true, + defaultValue: null, + primaryKey: false, + autoIncrement: false, + comment: null, + field: "fee" + }, + tip: { + type: DataTypes.DOUBLE, + allowNull: true, + defaultValue: null, + primaryKey: false, + autoIncrement: false, + comment: null, + field: "tip" + }, + confirmed: { + type: DataTypes.INTEGER(1), + allowNull: false, + defaultValue: null, + primaryKey: false, + autoIncrement: false, + comment: null, + field: "confirmed" + } +}; + +const options = { + tableName: "payments", + comment: "", + indexes: [] +}; + +db["Payment"] = db.define("payments_model", attributes, options); diff --git a/db/models/users.js b/db/models/users.js new file mode 100644 index 00000000..d5b1f5b8 --- /dev/null +++ b/db/models/users.js @@ -0,0 +1,246 @@ +const { DataTypes } = require('sequelize'); + +const attributes = { + id: { + type: DataTypes.INTEGER(11), + allowNull: false, + defaultValue: null, + primaryKey: true, + autoIncrement: true, + comment: null, + field: "id" + }, + username: { + type: DataTypes.STRING(255), + allowNull: true, + defaultValue: null, + primaryKey: false, + autoIncrement: false, + comment: null, + field: "username" + }, + password: { + type: DataTypes.STRING(255), + allowNull: true, + defaultValue: null, + primaryKey: false, + autoIncrement: false, + comment: null, + field: "password" + }, + liquid: { + type: DataTypes.STRING(255), + allowNull: true, + defaultValue: null, + primaryKey: false, + autoIncrement: false, + comment: null, + field: "liquid" + }, + confidential: { + type: DataTypes.STRING(255), + allowNull: true, + defaultValue: null, + primaryKey: false, + autoIncrement: false, + comment: null, + field: "confidential" + }, + address: { + type: DataTypes.STRING(255), + allowNull: true, + defaultValue: null, + primaryKey: false, + autoIncrement: false, + comment: null, + field: "address" + }, + symbol: { + type: DataTypes.STRING(255), + allowNull: true, + defaultValue: null, + primaryKey: false, + autoIncrement: false, + comment: null, + field: "symbol" + }, + otpsecret: { + type: DataTypes.STRING(255), + allowNull: true, + defaultValue: "CAD", + primaryKey: false, + autoIncrement: false, + comment: null, + field: "otpsecret" + }, + currency: { + type: DataTypes.STRING(255), + allowNull: true, + defaultValue: "CAD", + primaryKey: false, + autoIncrement: false, + comment: null, + field: "currency" + }, + currencies: { + type: DataTypes.JSON, + allowNull: false, + defaultValue: ["USD"], + primaryKey: false, + autoIncrement: false, + comment: null, + field: "currencies" + }, + pubkey: { + type: DataTypes.STRING(255), + allowNull: true, + defaultValue: null, + primaryKey: false, + autoIncrement: false, + comment: null, + field: "pubkey" + }, + privkey: { + type: DataTypes.STRING(255), + allowNull: true, + defaultValue: null, + primaryKey: false, + autoIncrement: false, + comment: null, + field: "privkey" + }, + 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" + }, + index: { + type: DataTypes.INTEGER(11), + allowNull: true, + defaultValue: null, + primaryKey: false, + autoIncrement: false, + comment: null, + field: "index" + }, + balance: { + type: DataTypes.INTEGER(11), + allowNull: false, + defaultValue: "0", + primaryKey: false, + autoIncrement: false, + comment: null, + field: "balance" + }, + channel: { + type: DataTypes.STRING(255), + allowNull: true, + defaultValue: null, + primaryKey: false, + autoIncrement: false, + comment: null, + field: "channel" + }, + readonlypw: { + type: DataTypes.STRING(255), + allowNull: true, + defaultValue: null, + primaryKey: false, + autoIncrement: false, + comment: null, + field: "readonlypw" + }, + limit: { + type: DataTypes.INTEGER(11), + allowNull: true, + defaultValue: "0", + primaryKey: false, + autoIncrement: false, + comment: null, + field: "limit" + }, + fbtoken: { + type: DataTypes.STRING(255), + allowNull: true, + defaultValue: null, + primaryKey: false, + autoIncrement: false, + comment: null, + field: "fbtoken" + }, + friend: { + type: DataTypes.INTEGER(1), + allowNull: true, + defaultValue: null, + primaryKey: false, + autoIncrement: false, + comment: null, + field: "friend" + }, + pending: { + type: DataTypes.INTEGER(11), + allowNull: true, + defaultValue: "0", + primaryKey: false, + autoIncrement: false, + comment: null, + field: "pending" + }, + name: { + type: DataTypes.STRING(255), + allowNull: true, + defaultValue: null, + primaryKey: false, + autoIncrement: false, + comment: null, + field: "name" + }, + pic: { + type: DataTypes.STRING(255), + allowNull: true, + defaultValue: null, + primaryKey: false, + autoIncrement: false, + comment: null, + field: "pic" + }, + twofa: { + type: DataTypes.INTEGER(1), + allowNull: true, + defaultValue: null, + primaryKey: false, + autoIncrement: false, + comment: null, + field: "twofa" + }, + pin: { + type: DataTypes.STRING(255), + allowNull: true, + defaultValue: null, + primaryKey: false, + autoIncrement: false, + comment: null, + field: "pin" + }, +}; + +const options = { + tableName: "users", + comment: "", + indexes: [] +}; + +db["User"] = db.define("users_model", attributes, options); |
