From c6198b7220931156195ebeb7901cd3cda13dd926 Mon Sep 17 00:00:00 2001 From: Bartha Maxime <231026@umons.ac.be> Date: Sat, 16 Mar 2024 09:02:08 +0100 Subject: [PATCH] cleaned Services + added private final to all repos --- .../Clyde/Services/AuthenticatorService.java | 2 -- .../herisson/Clyde/Services/InscriptionService.java | 13 +++++-------- .../ovh/herisson/Clyde/Services/StorageService.java | 2 -- .../ovh/herisson/Clyde/Services/TokenService.java | 4 +--- .../main/java/ovh/herisson/Clyde/Tables/Course.java | 2 +- 5 files changed, 7 insertions(+), 16 deletions(-) diff --git a/backend/src/main/java/ovh/herisson/Clyde/Services/AuthenticatorService.java b/backend/src/main/java/ovh/herisson/Clyde/Services/AuthenticatorService.java index 1cc18e1..a3301c1 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/Services/AuthenticatorService.java +++ b/backend/src/main/java/ovh/herisson/Clyde/Services/AuthenticatorService.java @@ -1,8 +1,6 @@ package ovh.herisson.Clyde.Services; import org.springframework.stereotype.Service; -import ovh.herisson.Clyde.EndPoints.LoginController; -import ovh.herisson.Clyde.Repositories.InscriptionRepository; import ovh.herisson.Clyde.Tables.InscriptionRequest; import ovh.herisson.Clyde.Tables.Role; import ovh.herisson.Clyde.Tables.Token; diff --git a/backend/src/main/java/ovh/herisson/Clyde/Services/InscriptionService.java b/backend/src/main/java/ovh/herisson/Clyde/Services/InscriptionService.java index 45495b7..318dfc1 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/Services/InscriptionService.java +++ b/backend/src/main/java/ovh/herisson/Clyde/Services/InscriptionService.java @@ -4,23 +4,20 @@ import org.springframework.stereotype.Service; import ovh.herisson.Clyde.Repositories.InscriptionRepository; import ovh.herisson.Clyde.Tables.InscriptionRequest; -import java.util.HashMap; -import java.util.Map; - @Service public class InscriptionService { - InscriptionRepository incriptionRepo; + private final InscriptionRepository inscriptionRepo; public void save(InscriptionRequest inscriptionRequest){ - incriptionRepo.save(inscriptionRequest); + inscriptionRepo.save(inscriptionRequest); } public InscriptionService(InscriptionRepository inscriptionRepo){ - this.incriptionRepo = inscriptionRepo; + this.inscriptionRepo = inscriptionRepo; } public InscriptionRequest getById(long id){ - InscriptionRequest inscriptionRequest = incriptionRepo.findById(id); + InscriptionRequest inscriptionRequest = inscriptionRepo.findById(id); if (inscriptionRequest == null){ return null; @@ -29,6 +26,6 @@ public class InscriptionService { } public Iterable getAll(){ - return incriptionRepo.findAll(); + return inscriptionRepo.findAll(); } } \ No newline at end of file diff --git a/backend/src/main/java/ovh/herisson/Clyde/Services/StorageService.java b/backend/src/main/java/ovh/herisson/Clyde/Services/StorageService.java index c7f8d1b..fb04f68 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/Services/StorageService.java +++ b/backend/src/main/java/ovh/herisson/Clyde/Services/StorageService.java @@ -4,10 +4,8 @@ import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; import ovh.herisson.Clyde.Repositories.FileRepository; import ovh.herisson.Clyde.Tables.*; - import java.io.File; import java.io.IOException; - import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; diff --git a/backend/src/main/java/ovh/herisson/Clyde/Services/TokenService.java b/backend/src/main/java/ovh/herisson/Clyde/Services/TokenService.java index 50ddcbf..ce0d109 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/Services/TokenService.java +++ b/backend/src/main/java/ovh/herisson/Clyde/Services/TokenService.java @@ -5,16 +5,14 @@ import org.springframework.stereotype.Service; import ovh.herisson.Clyde.Repositories.TokenRepository; import ovh.herisson.Clyde.Tables.Token; import ovh.herisson.Clyde.Tables.User; - import java.io.UnsupportedEncodingException; import java.security.SecureRandom; import java.util.ArrayList; import java.util.Calendar; -import java.util.Date; @Service public class TokenService { - TokenRepository tokenRepo; + private final TokenRepository tokenRepo; public TokenService(TokenRepository tokenRepo){ this.tokenRepo = tokenRepo; diff --git a/backend/src/main/java/ovh/herisson/Clyde/Tables/Course.java b/backend/src/main/java/ovh/herisson/Clyde/Tables/Course.java index 54e167a..fb11604 100644 --- a/backend/src/main/java/ovh/herisson/Clyde/Tables/Course.java +++ b/backend/src/main/java/ovh/herisson/Clyde/Tables/Course.java @@ -1,6 +1,6 @@ package ovh.herisson.Clyde.Tables; -import jakarta.persistence.Entity; +import ja karta.persistence.Entity; import jakarta.persistence.GeneratedValue; import jakarta.persistence.GenerationType; import jakarta.persistence.Id;