aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2022-11-03 01:28:29 -0700
committerAdam Soltys <[email protected]>2022-11-03 01:28:29 -0700
commitda2a1713b13b31310843136eeaabe524c4eee42c (patch)
treee0b575fdc59535bd6d60b2f069933627a8601c0d
parent7d5a9b5a8f82fc4b6c2849dfb5b7f27a2b54a912 (diff)
downloadcoinos-server-da2a1713b13b31310843136eeaabe524c4eee42c.tar.gz
coinos-server-da2a1713b13b31310843136eeaabe524c4eee42c.zip
with relation
-rw-r--r--db/index.js5
-rw-r--r--routes/payments.js5
2 files changed, 10 insertions, 0 deletions
diff --git a/db/index.js b/db/index.js
index 8c94a4d3..81c0fe46 100644
--- a/db/index.js
+++ b/db/index.js
@@ -124,6 +124,11 @@ Payment.belongsTo(Payment, {
foreignKey: "fee_payment_id"
});
+Payment.belongsTo(User, {
+ as: "with",
+ foreignKey: "with_id"
+});
+
db.Order = Order;
export default db;
diff --git a/routes/payments.js b/routes/payments.js
index 678b646c..999cba36 100644
--- a/routes/payments.js
+++ b/routes/payments.js
@@ -125,6 +125,11 @@ app.get("/payments", auth, async (req, res) => {
model: db.Account,
as: "account"
},
+ include: {
+ attrs: ["username", "profile"],
+ model: db.User,
+ as: "with"
+ },
limit,
offset
});