aboutsummaryrefslogtreecommitdiffstats
path: root/db
diff options
context:
space:
mode:
Diffstat (limited to 'db')
-rw-r--r--db/index.js12
-rw-r--r--db/models/orders.js (renamed from db/models/proposals.js)31
2 files changed, 8 insertions, 35 deletions
diff --git a/db/index.js b/db/index.js
index 0772bfc7..2ee61643 100644
--- a/db/index.js
+++ b/db/index.js
@@ -13,10 +13,10 @@ require("./models/codes.js");
require("./models/invoices.js");
require("./models/keys.js");
require("./models/payments.js");
-require("./models/proposals.js");
+require("./models/orders.js");
require("./models/users.js");
-const { User, Account, Payment, Invoice, Key, Proposal } = db;
+const { User, Account, Payment, Invoice, Key, Order } = db;
User.hasMany(Account, {
as: "accounts",
@@ -73,19 +73,19 @@ Payment.belongsTo(User, {
foreignKey: "user_id"
});
-Proposal.belongsTo(User, {
+Order.belongsTo(User, {
as: "user",
foreignKey: "user_id"
});
-Proposal.belongsTo(Account, {
+Order.belongsTo(Account, {
as: "acc1",
foreignKey: "a1_id"
});
-Proposal.belongsTo(Account, {
+Order.belongsTo(Account, {
as: "acc2",
foreignKey: "a2_id"
});
-db.Proposal = Proposal;
+db.Order = Order;
diff --git a/db/models/proposals.js b/db/models/orders.js
index 1f93ba06..e9c701a3 100644
--- a/db/models/proposals.js
+++ b/db/models/orders.js
@@ -64,15 +64,6 @@ const attributes = {
comment: null,
field: "updatedAt"
},
- fee: {
- type: DataTypes.DOUBLE,
- allowNull: true,
- defaultValue: null,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "fee"
- },
v1: {
type: DataTypes.DOUBLE,
allowNull: true,
@@ -100,24 +91,6 @@ const attributes = {
comment: null,
field: "rate"
},
- text: {
- type: DataTypes.TEXT,
- allowNull: false,
- defaultValue: false,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "text"
- },
- public: {
- type: DataTypes.BOOLEAN,
- allowNull: false,
- defaultValue: false,
- primaryKey: false,
- autoIncrement: false,
- comment: null,
- field: "public"
- },
accepted: {
type: DataTypes.BOOLEAN,
allowNull: false,
@@ -130,9 +103,9 @@ const attributes = {
};
const options = {
- tableName: "proposals",
+ tableName: "orders",
comment: "",
indexes: []
};
-db.Proposal = db.define("proposals_model", attributes, options);
+db.Order = db.define("orders_model", attributes, options);