implemented has method

This commit is contained in:
SrGooglo 2023-07-27 00:06:03 +00:00
parent 13bdccd53d
commit 1f73d01e3c

View File

@ -114,4 +114,21 @@ export default class SecureSyncEntry {
return entry return entry
} }
static async has(user_id, key) {
if (!user_id) {
throw new Error("Missing user_id")
}
if (!key) {
throw new Error("Missing key")
}
const entry = await SyncEntry.findOne({
user_id,
key,
}).catch(() => null)
return !!entry
}
} }