Merge remote-tracking branch 'origin/main'
This commit is contained in:
@@ -6,7 +6,8 @@ import java.util.List;
|
||||
|
||||
public interface UserService {
|
||||
List<User> listeUtilisateurs();
|
||||
User utilisateur();
|
||||
User utilisateur(int id);
|
||||
void setUtilisateur(User utilisateur);
|
||||
void editUtilisateur(int id);
|
||||
void deleteUtilisateur(int id);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package fr.eni.enchere.bll;
|
||||
|
||||
import fr.eni.enchere.bo.User;
|
||||
import fr.eni.enchere.dall.UserRepository;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
@@ -8,23 +9,34 @@ import java.util.List;
|
||||
@Service("UtilisateurService")
|
||||
public class UserServiceImpl implements UserService {
|
||||
|
||||
@Override
|
||||
public List<User> listeUtilisateurs() {
|
||||
return List.of();
|
||||
public UserRepository userRepository;
|
||||
|
||||
public UserServiceImpl(UserRepository userRepository) {
|
||||
this.userRepository = userRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public User utilisateur() {
|
||||
return null;
|
||||
public List<User> listeUtilisateurs() {
|
||||
return userRepository.findAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public User utilisateur(int id) {
|
||||
return userRepository.findById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUtilisateur(User utilisateur) {
|
||||
userRepository.save(utilisateur);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void editUtilisateur(int id) {
|
||||
userRepository.edit(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteUtilisateur(int id) {
|
||||
|
||||
userRepository.delete(id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,5 +8,6 @@ public interface UserRepository {
|
||||
List<User> findAll();
|
||||
User findById(int id);
|
||||
User save(User utilisateur);
|
||||
void delete(User utilisateur);
|
||||
void edit(int id);
|
||||
void delete(int id);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
package fr.eni.enchere.dall;
|
||||
|
||||
import fr.eni.enchere.bo.User;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public class UserRepositoryImpl implements UserRepository {
|
||||
|
||||
@Override
|
||||
public List<User> findAll() {
|
||||
return List.of();
|
||||
@@ -21,7 +24,12 @@ public class UserRepositoryImpl implements UserRepository {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(User utilisateur) {
|
||||
public void edit(int id) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(int id) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,10 +8,10 @@
|
||||
<!-- Ajouter la page de nav bar -->
|
||||
<div id="container-main">
|
||||
<form th:action="@{/newUser}" method="post" th:object="${user}">
|
||||
<div class="erreur-saisie" th:if="${#fields.hasErrors('*')}" >
|
||||
<!--<div class="erreur-saisie" th:if="${#fields.hasErrors('*')}" >
|
||||
<p th:text="#{index.erreurs}">Message d'erreur</p>
|
||||
</div>
|
||||
|
||||
</div>-->
|
||||
<!-- Champ pseudo-->
|
||||
<div class="champ-saisie">
|
||||
<label for="pseudo">Pseudo: </label>
|
||||
<div>
|
||||
@@ -23,31 +23,31 @@
|
||||
</ul>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<!-- Champ prénom-->
|
||||
<div class="champ-saisie">
|
||||
<label for="firstName">Prénom: </label>
|
||||
<label for="prenom">Prénom: </label>
|
||||
<div>
|
||||
<input type="text" th:field="*{firstName}" id="firstName" />
|
||||
<input type="text" th:field="*{prenom}" id="prenom" />
|
||||
</div>
|
||||
<span style="color: red;" th:if="${#fields.hasErrors('firstName')}">
|
||||
<span style="color: red;" th:if="${#fields.hasErrors('prenom')}">
|
||||
<ul>
|
||||
<li th:each="erreur: ${#fields.errors('firstName')}" th:text="${erreur}"></li>
|
||||
<li th:each="erreur: ${#fields.errors('prenom')}" th:text="${erreur}"></li>
|
||||
</ul>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<!-- Champ nom-->
|
||||
<div class="champ-saisie">
|
||||
<label for="lastName">Nom: </label>
|
||||
<label for="nom">Nom: </label>
|
||||
<div>
|
||||
<input type="text" th:field="*{lastName}" id="lastName" />
|
||||
<input type="text" th:field="*{nom}" id="nom" />
|
||||
</div>
|
||||
<span style="color: red;" th:if="${#fields.hasErrors('lastName')}">
|
||||
<span style="color: red;" th:if="${#fields.hasErrors('nom')}">
|
||||
<ul>
|
||||
<li th:each="erreur: ${#fields.errors('lastName')}" th:text="${erreur}"></li>
|
||||
<li th:each="erreur: ${#fields.errors('nom')}" th:text="${erreur}"></li>
|
||||
</ul>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<!-- Champ email-->
|
||||
<div class="champ-saisie">
|
||||
<label for="email">Email: </label>
|
||||
<div>
|
||||
@@ -59,18 +59,72 @@
|
||||
</ul>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<!-- Champ téléphone-->
|
||||
<div class="champ-saisie">
|
||||
<label for="phone">Téléphone: </label>
|
||||
<label for="telephone">Téléphone: </label>
|
||||
<div>
|
||||
<input type="text" th:field="*{phone}" id="phone" />
|
||||
<input type="tel" th:field="*{telephone}" id="telephone" />
|
||||
</div>
|
||||
<span style="color: red;" th:if="${#fields.hasErrors('phone')}">
|
||||
<span style="color: red;" th:if="${#fields.hasErrors('telephone')}">
|
||||
<ul>
|
||||
<li th:each="erreur: ${#fields.errors('phone')}" th:text="${erreur}"></li>
|
||||
<li th:each="erreur: ${#fields.errors('telephone')}" th:text="${erreur}"></li>
|
||||
</ul>
|
||||
</span>
|
||||
</div>
|
||||
<!-- Champ Rue-->
|
||||
<div class="champ-saisie">
|
||||
<label for="rue">Rue: </label>
|
||||
<div>
|
||||
<input type="text" th:field="*{rue}" id="rue" />
|
||||
</div>
|
||||
<span style="color: red;" th:if="${#fields.hasErrors('rue')}">
|
||||
<ul>
|
||||
<li th:each="erreur: ${#fields.errors('rue')}" th:text="${erreur}"></li>
|
||||
</ul>
|
||||
</span>
|
||||
</div>
|
||||
<!-- Champ Code postal-->
|
||||
<div class="champ-saisie">
|
||||
<label for="code_postal">Code postal: </label>
|
||||
<div>
|
||||
<input type="number" th:field="*{code_postal}" id="code_postal" />
|
||||
</div>
|
||||
<span style="color: red;" th:if="${#fields.hasErrors('code_postal')}">
|
||||
<ul>
|
||||
<li th:each="erreur: ${#fields.errors('code_postal')}" th:text="${erreur}"></li>
|
||||
</ul>
|
||||
</span>
|
||||
</div>
|
||||
<!-- Champ Ville-->
|
||||
<div class="champ-saisie">
|
||||
<label for="code_postal">Ville: </label>
|
||||
<div>
|
||||
<input type="text" th:field="*{ville}" id="ville" />
|
||||
</div>
|
||||
<span style="color: red;" th:if="${#fields.hasErrors('ville')}">
|
||||
<ul>
|
||||
<li th:each="erreur: ${#fields.errors('ville')}" th:text="${erreur}"></li>
|
||||
</ul>
|
||||
</span>
|
||||
</div>
|
||||
<!-- Champ Mot de passe-->
|
||||
<div class="champ-saisie">
|
||||
<label for="password">Mot de passe: </label>
|
||||
<div>
|
||||
<input type="password" th:field="*{password}" id="password" />
|
||||
</div>
|
||||
<span style="color: red;" th:if="${#fields.hasErrors('password')}">
|
||||
<ul>
|
||||
<li th:each="erreur: ${#fields.errors('password')}" th:text="${erreur}"></li>
|
||||
</ul>
|
||||
</span>
|
||||
</div>
|
||||
<div class="champ-saisie">
|
||||
<label for="password">Confirmation du mot de passe: </label>
|
||||
<div>
|
||||
<input type="password" id="password" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button>Créer</button>
|
||||
<button>Annuler</button>
|
||||
|
||||
Reference in New Issue
Block a user