cleaned Services + added private final to all repos
This commit is contained in:
parent
13fd048cd2
commit
c6198b7220
@ -1,8 +1,6 @@
|
|||||||
package ovh.herisson.Clyde.Services;
|
package ovh.herisson.Clyde.Services;
|
||||||
|
|
||||||
import org.springframework.stereotype.Service;
|
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.InscriptionRequest;
|
||||||
import ovh.herisson.Clyde.Tables.Role;
|
import ovh.herisson.Clyde.Tables.Role;
|
||||||
import ovh.herisson.Clyde.Tables.Token;
|
import ovh.herisson.Clyde.Tables.Token;
|
||||||
|
@ -4,23 +4,20 @@ import org.springframework.stereotype.Service;
|
|||||||
import ovh.herisson.Clyde.Repositories.InscriptionRepository;
|
import ovh.herisson.Clyde.Repositories.InscriptionRepository;
|
||||||
import ovh.herisson.Clyde.Tables.InscriptionRequest;
|
import ovh.herisson.Clyde.Tables.InscriptionRequest;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class InscriptionService {
|
public class InscriptionService {
|
||||||
|
|
||||||
InscriptionRepository incriptionRepo;
|
private final InscriptionRepository inscriptionRepo;
|
||||||
public void save(InscriptionRequest inscriptionRequest){
|
public void save(InscriptionRequest inscriptionRequest){
|
||||||
incriptionRepo.save(inscriptionRequest);
|
inscriptionRepo.save(inscriptionRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
public InscriptionService(InscriptionRepository inscriptionRepo){
|
public InscriptionService(InscriptionRepository inscriptionRepo){
|
||||||
this.incriptionRepo = inscriptionRepo;
|
this.inscriptionRepo = inscriptionRepo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public InscriptionRequest getById(long id){
|
public InscriptionRequest getById(long id){
|
||||||
InscriptionRequest inscriptionRequest = incriptionRepo.findById(id);
|
InscriptionRequest inscriptionRequest = inscriptionRepo.findById(id);
|
||||||
|
|
||||||
if (inscriptionRequest == null){
|
if (inscriptionRequest == null){
|
||||||
return null;
|
return null;
|
||||||
@ -29,6 +26,6 @@ public class InscriptionService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Iterable<InscriptionRequest> getAll(){
|
public Iterable<InscriptionRequest> getAll(){
|
||||||
return incriptionRepo.findAll();
|
return inscriptionRepo.findAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -4,10 +4,8 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
import ovh.herisson.Clyde.Repositories.FileRepository;
|
import ovh.herisson.Clyde.Repositories.FileRepository;
|
||||||
import ovh.herisson.Clyde.Tables.*;
|
import ovh.herisson.Clyde.Tables.*;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
|
@ -5,16 +5,14 @@ import org.springframework.stereotype.Service;
|
|||||||
import ovh.herisson.Clyde.Repositories.TokenRepository;
|
import ovh.herisson.Clyde.Repositories.TokenRepository;
|
||||||
import ovh.herisson.Clyde.Tables.Token;
|
import ovh.herisson.Clyde.Tables.Token;
|
||||||
import ovh.herisson.Clyde.Tables.User;
|
import ovh.herisson.Clyde.Tables.User;
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.security.SecureRandom;
|
import java.security.SecureRandom;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class TokenService {
|
public class TokenService {
|
||||||
TokenRepository tokenRepo;
|
private final TokenRepository tokenRepo;
|
||||||
|
|
||||||
public TokenService(TokenRepository tokenRepo){
|
public TokenService(TokenRepository tokenRepo){
|
||||||
this.tokenRepo = tokenRepo;
|
this.tokenRepo = tokenRepo;
|
||||||
|
Loading…
Reference in New Issue
Block a user