implemented has method

This commit is contained in:
SrGooglo 2023-07-27 00:06:03 +00:00
parent 5dcc721bc6
commit ca6aa521c0

View File

@ -114,4 +114,21 @@ export default class SecureSyncEntry {
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
}
}