1
0
forked from PGL/Clyde

cleaned Services + added private final to all repos

This commit is contained in:
Bartha Maxime 2024-03-16 09:02:08 +01:00
parent 13fd048cd2
commit c6198b7220
5 changed files with 7 additions and 16 deletions

View File

@ -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;

View File

@ -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<InscriptionRequest> getAll(){
return incriptionRepo.findAll();
return inscriptionRepo.findAll();
}
}

View File

@ -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;

View File

@ -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;

View File

@ -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;