aboutsummaryrefslogtreecommitdiffstats
path: root/routes
diff options
context:
space:
mode:
Diffstat (limited to 'routes')
-rw-r--r--routes/users.ts9
1 files changed, 5 insertions, 4 deletions
diff --git a/routes/users.ts b/routes/users.ts
index 3381af83..a2b3b407 100644
--- a/routes/users.ts
+++ b/routes/users.ts
@@ -415,9 +415,8 @@ export default {
},
async contacts(req, res) {
- const {
- user: { id },
- } = req;
+ const { params, user } = req;
+ const { id } = user;
const lastlen = (await g(`${id}:lastlen`)) || 0;
const len = await db.lLen(`${id}:payments`);
const payments =
@@ -441,7 +440,9 @@ export default {
await s(`${id}:contacts`, contacts);
- res.send(contacts);
+ let { limit } = params;
+ limit ||= contacts.length;
+ res.send(contacts.slice(0, limit));
},
async del(req, res) {