feat: allow exists methods to work with arrays and single id

This commit is contained in:
Barış Soner Uşaklı
2021-03-31 13:20:35 -04:00
parent d16b45fd2d
commit 285aa36556
4 changed files with 17 additions and 13 deletions

View File

@@ -40,8 +40,12 @@ require('./online')(User);
require('./blocks')(User);
require('./uploads')(User);
User.exists = async function (uid) {
return await db.isSortedSetMember('users:joindate', uid);
User.exists = async function (uids) {
return await (
Array.isArray(uids) ?
db.isSortedSetMembers('users:joindate', uids) :
db.isSortedSetMember('users:joindate', uids)
);
};
User.existsBySlug = async function (userslug) {