diff options
| author | Adam Soltys <[email protected]> | 2020-04-24 22:46:45 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2020-04-24 22:46:45 -0700 |
| commit | 83f973224bad381df62774bcc058f76eab635f0c (patch) | |
| tree | ef231f4490b0c9d194b8683be50c05524738903e /db | |
| parent | 306357c24d3014b55ae1cd25b954a695ea2e5cc6 (diff) | |
| download | coinos-server-assets.tar.gz coinos-server-assets.zip | |
wipassets
Diffstat (limited to 'db')
| -rw-r--r-- | db/index.js | 10 | ||||
| -rw-r--r-- | db/models/accounts.js | 27 | ||||
| -rw-r--r-- | db/models/payments.js | 9 | ||||
| -rw-r--r-- | db/models/users.js | 78 |
4 files changed, 49 insertions, 75 deletions
diff --git a/db/index.js b/db/index.js index bb94fb98..215d34df 100644 --- a/db/index.js +++ b/db/index.js @@ -28,6 +28,11 @@ db["User"].hasMany(db["Payment"], { foreignKey: "user_id" }); +db["User"].belongsTo(db["Account"], { + as: "account", + foreignKey: "account_id" +}); + db["Account"].belongsTo(db["User"], { as: "user", foreignKey: "user_id" @@ -38,6 +43,11 @@ db["Invoice"].belongsTo(db["User"], { foreignKey: "user_id" }); +db["Payment"].belongsTo(db["Account"], { + as: "account", + foreignKey: "account_id" +}); + db["Payment"].belongsTo(db["User"], { as: "user", foreignKey: "user_id" diff --git a/db/models/accounts.js b/db/models/accounts.js index aeaf8d5e..a4b38992 100644 --- a/db/models/accounts.js +++ b/db/models/accounts.js @@ -37,6 +37,24 @@ const attributes = { comment: null, field: "updatedAt" }, + name: { + type: DataTypes.STRING(255), + allowNull: true, + defaultValue: null, + primaryKey: false, + autoIncrement: false, + comment: null, + field: "name" + }, + ticker: { + type: DataTypes.STRING(255), + allowNull: true, + defaultValue: null, + primaryKey: false, + autoIncrement: false, + comment: null, + field: "ticker" + }, asset: { type: DataTypes.STRING(255), allowNull: true, @@ -64,6 +82,15 @@ const attributes = { comment: null, field: "pending" }, + precision: { + type: DataTypes.DOUBLE, + allowNull: true, + defaultValue: null, + primaryKey: false, + autoIncrement: false, + comment: null, + field: "precision" + }, }; const options = { diff --git a/db/models/payments.js b/db/models/payments.js index c6dd6e83..4859bce7 100644 --- a/db/models/payments.js +++ b/db/models/payments.js @@ -10,6 +10,15 @@ const attributes = { comment: null, field: "id" }, + account_id: { + type: DataTypes.INTEGER(11), + allowNull: true, + defaultValue: null, + primaryKey: false, + autoIncrement: false, + comment: null, + field: "account_id" + }, user_id: { type: DataTypes.INTEGER(11), allowNull: true, diff --git a/db/models/users.js b/db/models/users.js index 48e8c94f..439ddb63 100644 --- a/db/models/users.js +++ b/db/models/users.js @@ -64,14 +64,14 @@ const attributes = { comment: null, field: "address" }, - symbol: { - type: DataTypes.STRING(255), + account_id: { + type: DataTypes.INTEGER(11), allowNull: true, defaultValue: null, primaryKey: false, autoIncrement: false, comment: null, - field: "symbol" + field: "account_id" }, otpsecret: { type: DataTypes.STRING(255), @@ -100,24 +100,6 @@ const attributes = { 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, @@ -145,42 +127,6 @@ const attributes = { 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, @@ -190,24 +136,6 @@ const attributes = { 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, |
