aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--routes/users.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/routes/users.js b/routes/users.js
index c3ceb35e..319a39c4 100644
--- a/routes/users.js
+++ b/routes/users.js
@@ -673,12 +673,12 @@ app.get("/contacts", auth, async function(req, res) {
model: db.User,
as: "with"
},
- attributes: ["id"],
+ attributes: ["createdAt"],
group: ["with_id"],
- order: [[{ model: db.User, as: "with" }, "username", "ASC"]]
+ order: [['createdAt'], [{ model: db.User, as: "with" }, "username", "ASC"]]
});
- res.send(contacts.map(c => c.with));
+ res.send(contacts.map(c => ({ ...c.with.get({ plain: true }), last: c.createdAt })));
} catch (e) {
console.log(e);
res.code(500).send(e.message);