MORE UNIT TESTS - approc 90% before - 95% now?
All checks were successful
Deploy to Test Environment / deploy-to-test (push) Successful in 45m25s
All checks were successful
Deploy to Test Environment / deploy-to-test (push) Successful in 45m25s
This commit is contained in:
@@ -444,6 +444,23 @@ export class UserRepository {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes all expired password reset tokens from the database.
|
||||
* This is intended for a periodic cleanup job.
|
||||
* @returns A promise that resolves to the number of deleted tokens.
|
||||
*/
|
||||
async deleteExpiredResetTokens(logger: Logger): Promise<number> {
|
||||
try {
|
||||
const res = await this.db.query(
|
||||
"DELETE FROM public.password_reset_tokens WHERE expires_at < NOW()"
|
||||
);
|
||||
logger.info(`[DB deleteExpiredResetTokens] Deleted ${res.rowCount ?? 0} expired password reset tokens.`);
|
||||
return res.rowCount ?? 0;
|
||||
} catch (error) {
|
||||
logger.error({ err: error }, 'Database error in deleteExpiredResetTokens');
|
||||
throw new Error('Failed to delete expired password reset tokens.');
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Creates a following relationship between two users.
|
||||
* @param followerId The ID of the user who is following.
|
||||
|
||||
Reference in New Issue
Block a user