* @param {number|string} user_id - User ID
* @param {string[]} [excludes=['password', 'password_salt']] - Fields to exclude from result
* @returns {Promise<Authentication|null>} Authentication instance or null
- * @throws {NotFoundError} If record not found
- * @throws {TypeError} If user_id is invalid
*/
static async find_by_user_id( user_id, excludes = ['password', 'password_salt'] ) {
return await new Authentication().find_one( { user_id }, excludes );
* @param {string} password_reset_token - Password reset token
* @param {string[]} [excludes=['password', 'password_salt']] - Fields to exclude from result
* @returns {Promise<Authentication|null>} Authentication instance or null
- * @throws {NotFoundError} If record not found
- * @throws {TypeError} If password_reset_token is invalid
*/
static async find_by_reset_token( password_reset_token, excludes = ['password', 'password_salt'] ) {
return await new Authentication().find_one( { password_reset_token }, excludes );