Leo/Backend #82

Merged
Maxime merged 11 commits from Leo/Backend into master 2024-03-11 19:16:20 +01:00
Showing only changes of commit cfc6c59684 - Show all commits

View File

@ -42,8 +42,9 @@ public class TokenService {
public void saveToken(Token token){
//Si l'utilisateur a déja 5 token delete celui qui devait expirer le plus vite
ArrayList<Token> tokenList = tokenRepo.getByUserOrderByExpirationDate(token.getUser());
if (tokenList.size() == 5){
while(tokenList.size() >= 5){
tokenRepo.delete(tokenList.get(0));
tokenList.remove(tokenList.get(0));
}
tokenRepo.save(token);
}