Updated + first rough implementation

This commit is contained in:
lukeIam 2023-09-13 16:35:39 +00:00
parent f0f03efe17
commit 405c954b65
5 changed files with 104 additions and 25 deletions

View file

@ -194,6 +194,25 @@ class User extends Model {
return this.getOldUser(user)
}
/**
* Get user by email case insensitive
* @param {string} username
* @returns {Promise<oldUser|null>} returns null if not found
*/
static async getUserByEmail(email) {
if (!email) return null
const user = await this.findOne({
where: {
email: {
[Op.like]: email
}
},
include: this.sequelize.models.mediaProgress
})
if (!user) return null
return this.getOldUser(user)
}
/**
* Get user by id
* @param {string} userId