aboutsummaryrefslogtreecommitdiffstats
path: root/db
diff options
context:
space:
mode:
Diffstat (limited to 'db')
-rw-r--r--db/index.js21
1 files changed, 13 insertions, 8 deletions
diff --git a/db/index.js b/db/index.js
index 658a51a0..de9116a8 100644
--- a/db/index.js
+++ b/db/index.js
@@ -52,10 +52,10 @@ require("./normalized/waiting_list.js");
const { User, Account, Payment, Invoice, Key, Order } = db;
// move relationships to specfic models
-// User.hasMany(Account, {
-// as: "accounts",
-// foreignKey: "user_id"
-// });
+User.hasMany(Account, {
+ as: "accounts",
+ foreignKey: "user_id"
+});
User.hasMany(Invoice, {
as: "invoices",
@@ -67,6 +67,11 @@ User.hasMany(Key, {
foreignKey: "user_id"
});
+User.hasMany(Order, {
+ as: "orders",
+ foreignKey: "user_id"
+});
+
User.hasMany(Payment, {
as: "payments",
foreignKey: "user_id"
@@ -82,10 +87,10 @@ Invoice.belongsTo(Account, {
foreignKey: "account_id"
});
-// Account.belongsTo(User, {
-// as: "user",
-// foreignKey: "user_id"
-// });
+Account.belongsTo(User, {
+ as: "user",
+ foreignKey: "user_id"
+});
Invoice.belongsTo(User, {
as: "user",