added InscriptionController
All checks were successful
Build and test backend / Build-backend (pull_request) Successful in 2m2s
Build and test backend / Test-backend (pull_request) Successful in 1m59s
Build and test FrontEnd / Build-frontend (pull_request) Successful in 24s

This commit is contained in:
2024-03-14 16:36:09 +01:00
parent 157e5951fc
commit f0a411c031
5 changed files with 107 additions and 7 deletions

View File

@ -2,6 +2,7 @@ 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.Token;
import ovh.herisson.Clyde.Tables.User;
@ -13,10 +14,12 @@ public class AuthenticatorService {
private final TokenService tokenService;
private final UserService userService;
private final InscriptionService inscriptionService;
public AuthenticatorService(TokenService tokenService, UserService userService){
public AuthenticatorService(TokenService tokenService, UserService userService, InscriptionService inscriptionService){
this.tokenService = tokenService;
this.userService = userService;
this.inscriptionService = inscriptionService;
}
public User getUserFromToken(String token){
@ -34,7 +37,6 @@ public class AuthenticatorService {
}
public void register(InscriptionRequest inscriptionRequest) {
inscriptionService.save(inscriptionRequest);
}
}

View File

@ -4,6 +4,9 @@ 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 {
@ -16,8 +19,16 @@ public class InscriptionService {
this.incriptionRepo = inscriptionRepo;
}
//todo return sans le mdp
public InscriptionRequest getById(int id){
return null;
public InscriptionRequest getById(long id){
InscriptionRequest inscriptionRequest = incriptionRepo.findById(id);
if (inscriptionRequest == null){
return null;
}
return inscriptionRequest;
}
public Iterable<InscriptionRequest> getAll(){
return incriptionRepo.findAll();
}
}