Base utilisateur
This commit is contained in:
12
src/main/java/fr/eni/enchere/bll/UserService.java
Normal file
12
src/main/java/fr/eni/enchere/bll/UserService.java
Normal file
@@ -0,0 +1,12 @@
|
||||
package fr.eni.enchere.bll;
|
||||
|
||||
import fr.eni.enchere.bo.User;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface UserService {
|
||||
List<User> listeUtilisateurs();
|
||||
User utilisateur();
|
||||
void setUtilisateur(User utilisateur);
|
||||
void deleteUtilisateur(int id);
|
||||
}
|
||||
30
src/main/java/fr/eni/enchere/bll/UserServiceImpl.java
Normal file
30
src/main/java/fr/eni/enchere/bll/UserServiceImpl.java
Normal file
@@ -0,0 +1,30 @@
|
||||
package fr.eni.enchere.bll;
|
||||
|
||||
import fr.eni.enchere.bo.User;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service("UtilisateurService")
|
||||
public class UserServiceImpl implements UserService {
|
||||
|
||||
@Override
|
||||
public List<User> listeUtilisateurs() {
|
||||
return List.of();
|
||||
}
|
||||
|
||||
@Override
|
||||
public User utilisateur() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUtilisateur(User utilisateur) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteUtilisateur(int id) {
|
||||
|
||||
}
|
||||
}
|
||||
134
src/main/java/fr/eni/enchere/bo/User.java
Normal file
134
src/main/java/fr/eni/enchere/bo/User.java
Normal file
@@ -0,0 +1,134 @@
|
||||
package fr.eni.enchere.bo;
|
||||
|
||||
public class User {
|
||||
|
||||
//Déclaration de variable
|
||||
private int id;
|
||||
private String pseudo;
|
||||
private String nom;
|
||||
private String prenom;
|
||||
private String email;
|
||||
private String telephone;
|
||||
private String rue;
|
||||
private String code_postal;
|
||||
private String ville;
|
||||
private String password; //Voir la sécurité du mot de passe
|
||||
private int credit;
|
||||
private boolean isAdmin;
|
||||
|
||||
//Constructeur
|
||||
public User(){}
|
||||
|
||||
public User(int id, String pseudo, String nom, String prenom, String email, String telephone, String rue, String code_postal, String ville, String password, int credit, boolean isAdmin) {
|
||||
setId(id);
|
||||
setPrenom(prenom);
|
||||
setNom(nom);
|
||||
setPseudo(pseudo);
|
||||
setEmail(email);
|
||||
setTelephone(telephone);
|
||||
setRue(rue);
|
||||
setCode_postal(code_postal);
|
||||
setVille(ville);
|
||||
setPassword(password);
|
||||
setCredit(credit);
|
||||
setAdmin(isAdmin);
|
||||
}
|
||||
|
||||
//Méthode getter et setter
|
||||
public String getPseudo() {
|
||||
return pseudo;
|
||||
}
|
||||
|
||||
public void setPseudo(String pseudo) {
|
||||
this.pseudo = pseudo;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getNom() {
|
||||
return nom;
|
||||
}
|
||||
|
||||
public void setNom(String nom) {
|
||||
this.nom = nom;
|
||||
}
|
||||
|
||||
public String getPrenom() {
|
||||
return prenom;
|
||||
}
|
||||
|
||||
public void setPrenom(String prenom) {
|
||||
this.prenom = prenom;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getTelephone() {
|
||||
return telephone;
|
||||
}
|
||||
|
||||
public void setTelephone(String telephone) {
|
||||
this.telephone = telephone;
|
||||
}
|
||||
|
||||
public String getRue() {
|
||||
return rue;
|
||||
}
|
||||
|
||||
public void setRue(String rue) {
|
||||
this.rue = rue;
|
||||
}
|
||||
|
||||
public String getCode_postal() {
|
||||
return code_postal;
|
||||
}
|
||||
|
||||
public void setCode_postal(String code_postal) {
|
||||
this.code_postal = code_postal;
|
||||
}
|
||||
|
||||
public String getVille() {
|
||||
return ville;
|
||||
}
|
||||
|
||||
public void setVille(String ville) {
|
||||
this.ville = ville;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public int getCredit() {
|
||||
return credit;
|
||||
}
|
||||
|
||||
public void setCredit(int credit) {
|
||||
this.credit = credit;
|
||||
}
|
||||
|
||||
public boolean isAdmin() {
|
||||
return isAdmin;
|
||||
}
|
||||
|
||||
public void setAdmin(boolean admin) {
|
||||
isAdmin = admin;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
package fr.eni.enchere.bo;
|
||||
|
||||
public class Utilisateur {
|
||||
}
|
||||
@@ -11,7 +11,7 @@ public class AdminController {
|
||||
}
|
||||
|
||||
@GetMapping( "/admin")
|
||||
public String viewAccueil(Model model) {
|
||||
public String viewAdminPanel(Model model) {
|
||||
return "admin";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package fr.eni.enchere.controllers;
|
||||
|
||||
import fr.eni.enchere.bll.UserService;
|
||||
import fr.eni.enchere.bo.User;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/inscription")
|
||||
public class InscriptionController {
|
||||
|
||||
private final UserService userService;
|
||||
|
||||
public InscriptionController(UserService userService) {
|
||||
this.userService = userService;
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
public String viewInscription(Model model) {
|
||||
model.addAttribute("user", new User());
|
||||
return "inscription";
|
||||
}
|
||||
}
|
||||
12
src/main/java/fr/eni/enchere/dall/UserRepository.java
Normal file
12
src/main/java/fr/eni/enchere/dall/UserRepository.java
Normal file
@@ -0,0 +1,12 @@
|
||||
package fr.eni.enchere.dall;
|
||||
|
||||
import fr.eni.enchere.bo.User;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface UserRepository {
|
||||
List<User> findAll();
|
||||
User findById(int id);
|
||||
User save(User utilisateur);
|
||||
void delete(User utilisateur);
|
||||
}
|
||||
27
src/main/java/fr/eni/enchere/dall/UserRepositoryImpl.java
Normal file
27
src/main/java/fr/eni/enchere/dall/UserRepositoryImpl.java
Normal file
@@ -0,0 +1,27 @@
|
||||
package fr.eni.enchere.dall;
|
||||
|
||||
import fr.eni.enchere.bo.User;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class UserRepositoryImpl implements UserRepository {
|
||||
@Override
|
||||
public List<User> findAll() {
|
||||
return List.of();
|
||||
}
|
||||
|
||||
@Override
|
||||
public User findById(int id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public User save(User utilisateur) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(User utilisateur) {
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user