Max/Backend/Curriculum #106
@ -4,31 +4,24 @@ 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;
|
InscriptionRepository inscriptionRepo;
|
||||||
public void save(InscriptionRequest inscriptionRequest){
|
|
||||||
incriptionRepo.save(inscriptionRequest);
|
|
||||||
}
|
|
||||||
|
|
||||||
public InscriptionService(InscriptionRepository inscriptionRepo){
|
public InscriptionService(InscriptionRepository inscriptionRepo){
|
||||||
this.incriptionRepo = inscriptionRepo;
|
this.inscriptionRepo = inscriptionRepo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void save(InscriptionRequest inscriptionRequest){
|
||||||
|
inscriptionRepo.save(inscriptionRequest);
|
||||||
Maxime marked this conversation as resolved
|
|||||||
}
|
}
|
||||||
|
|
||||||
public InscriptionRequest getById(long id){
|
public InscriptionRequest getById(long id){
|
||||||
InscriptionRequest inscriptionRequest = incriptionRepo.findById(id);
|
return inscriptionRepo.findById(id);
|
||||||
Maxime marked this conversation as resolved
tonitch
commented
lol lol
|
|||||||
|
|
||||||
if (inscriptionRequest == null){
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return inscriptionRequest;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Iterable<InscriptionRequest> getAll(){
|
public Iterable<InscriptionRequest> getAll(){
|
||||||
return incriptionRepo.findAll();
|
return inscriptionRepo.findAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user
Comme je l'ai dit directement hier, c'est dommage parce que sa obfusque la fonction alors que tu pourrais faire directement
inscriptionService.inscriptionRepo.save(inscriptionRequest)
qui te retournerais en plus ton repo. Mais dans les faits ça n'est pas génant pour le projet non plus so you do you... hopefully ça ne vas pas géner quand on fera nos extensions individuelles x)