diff --git a/WEB-INF/classes/controleur/Accueil.class b/WEB-INF/classes/controleur/Accueil.class deleted file mode 100644 index 1a28c778be963150fd134e64f332347b3b53d4ab..0000000000000000000000000000000000000000 Binary files a/WEB-INF/classes/controleur/Accueil.class and /dev/null differ diff --git a/WEB-INF/classes/controleur/CreerFil.class b/WEB-INF/classes/controleur/CreerFil.class deleted file mode 100644 index 68182c701dd8a0f5026c6dd3e090b40856ded113..0000000000000000000000000000000000000000 Binary files a/WEB-INF/classes/controleur/CreerFil.class and /dev/null differ diff --git a/WEB-INF/classes/controleur/EnvoyerMessage.class b/WEB-INF/classes/controleur/EnvoyerMessage.class deleted file mode 100644 index a85ec4e38e5a09c52765c899b4c08ee18966cc1d..0000000000000000000000000000000000000000 Binary files a/WEB-INF/classes/controleur/EnvoyerMessage.class and /dev/null differ diff --git a/WEB-INF/classes/controleur/Fil.class b/WEB-INF/classes/controleur/Fil.class deleted file mode 100644 index 3ed1a7e3d82fe9b323a3251fdcfa8663664d9470..0000000000000000000000000000000000000000 Binary files a/WEB-INF/classes/controleur/Fil.class and /dev/null differ diff --git a/WEB-INF/classes/controleur/GetFils.class b/WEB-INF/classes/controleur/GetFils.class deleted file mode 100644 index bd0897871fc8577c174b302be6485dcd1d0a94b2..0000000000000000000000000000000000000000 Binary files a/WEB-INF/classes/controleur/GetFils.class and /dev/null differ diff --git a/WEB-INF/classes/controleur/Like.class b/WEB-INF/classes/controleur/Like.class deleted file mode 100644 index 7a4d000115a1f13997a308fa51e77f975a22ee65..0000000000000000000000000000000000000000 Binary files a/WEB-INF/classes/controleur/Like.class and /dev/null differ diff --git a/WEB-INF/classes/controleur/ListerFil.class b/WEB-INF/classes/controleur/ListerFil.class deleted file mode 100644 index 2b87ced72d52b7cd0b0429fc1e91fa962be23a88..0000000000000000000000000000000000000000 Binary files a/WEB-INF/classes/controleur/ListerFil.class and /dev/null differ diff --git a/WEB-INF/classes/controleur/Login.class b/WEB-INF/classes/controleur/Login.class deleted file mode 100644 index d41d887165f8658b7f4d0bb7ec25ce9a839d7bfe..0000000000000000000000000000000000000000 Binary files a/WEB-INF/classes/controleur/Login.class and /dev/null differ diff --git a/WEB-INF/classes/controleur/Logout.class b/WEB-INF/classes/controleur/Logout.class deleted file mode 100644 index 47db334fd4f25652266583b20ac7307fa5ad19d7..0000000000000000000000000000000000000000 Binary files a/WEB-INF/classes/controleur/Logout.class and /dev/null differ diff --git a/WEB-INF/classes/controleur/Register.class b/WEB-INF/classes/controleur/Register.class deleted file mode 100644 index 3ad8ee7a3668bb5e3ee876f44783e5867731b463..0000000000000000000000000000000000000000 Binary files a/WEB-INF/classes/controleur/Register.class and /dev/null differ diff --git a/WEB-INF/classes/controleur/SuivreFil.class b/WEB-INF/classes/controleur/SuivreFil.class deleted file mode 100644 index a300bccc79e70957f3d3a2d461ecbe356c26c148..0000000000000000000000000000000000000000 Binary files a/WEB-INF/classes/controleur/SuivreFil.class and /dev/null differ diff --git a/WEB-INF/classes/modele/Abonnement.class b/WEB-INF/classes/modele/Abonnement.class deleted file mode 100644 index ee41e5d8f300de99d400c65350de040019988fdf..0000000000000000000000000000000000000000 Binary files a/WEB-INF/classes/modele/Abonnement.class and /dev/null differ diff --git a/WEB-INF/classes/modele/AbonnementDao.class b/WEB-INF/classes/modele/AbonnementDao.class deleted file mode 100644 index 81902b953d1071f9235d21aa8cc166c1e97b8116..0000000000000000000000000000000000000000 Binary files a/WEB-INF/classes/modele/AbonnementDao.class and /dev/null differ diff --git a/WEB-INF/classes/modele/DS.class b/WEB-INF/classes/modele/DS.class deleted file mode 100644 index 0c876cb2214110b5d54f530a86c7693661d5ef41..0000000000000000000000000000000000000000 Binary files a/WEB-INF/classes/modele/DS.class and /dev/null differ diff --git a/WEB-INF/classes/modele/FilDeDiscussion.class b/WEB-INF/classes/modele/FilDeDiscussion.class deleted file mode 100644 index af362b08855ab40f70ebaea35cdc9fc11329cb1a..0000000000000000000000000000000000000000 Binary files a/WEB-INF/classes/modele/FilDeDiscussion.class and /dev/null differ diff --git a/WEB-INF/classes/modele/FilDeDiscussionDAO.class b/WEB-INF/classes/modele/FilDeDiscussionDAO.class deleted file mode 100644 index e9ac7a035fe79dcdda1a830dc60a468eaae94523..0000000000000000000000000000000000000000 Binary files a/WEB-INF/classes/modele/FilDeDiscussionDAO.class and /dev/null differ diff --git a/WEB-INF/classes/modele/Message.class b/WEB-INF/classes/modele/Message.class deleted file mode 100644 index cddf74058b4abd623ed0f2ef7127bfe249fc9f86..0000000000000000000000000000000000000000 Binary files a/WEB-INF/classes/modele/Message.class and /dev/null differ diff --git a/WEB-INF/classes/modele/MessageDao.class b/WEB-INF/classes/modele/MessageDao.class deleted file mode 100644 index e6d70a20e4d89db61f707e4bd4d9e9ed44eb3272..0000000000000000000000000000000000000000 Binary files a/WEB-INF/classes/modele/MessageDao.class and /dev/null differ diff --git a/WEB-INF/classes/modele/Utilisateur.class b/WEB-INF/classes/modele/Utilisateur.class deleted file mode 100644 index 0f9e1d29260afe61797c09c56070ffccb66a82ed..0000000000000000000000000000000000000000 Binary files a/WEB-INF/classes/modele/Utilisateur.class and /dev/null differ diff --git a/WEB-INF/classes/modele/UtilisateurDao.class b/WEB-INF/classes/modele/UtilisateurDao.class deleted file mode 100644 index ec400bcf77f08c69a12bdf1fd4bdb55c1d6e6361..0000000000000000000000000000000000000000 Binary files a/WEB-INF/classes/modele/UtilisateurDao.class and /dev/null differ diff --git a/WEB-INF/src/controleur/Accueil.java b/WEB-INF/src/controleur/Accueil.java deleted file mode 100644 index 1524c2f3bcfe5c353fe7e94f3feff9e6bfe17497..0000000000000000000000000000000000000000 --- a/WEB-INF/src/controleur/Accueil.java +++ /dev/null @@ -1,25 +0,0 @@ -package controleur; - -import java.io.IOException; -import jakarta.servlet.ServletException; -import jakarta.servlet.annotation.WebServlet; -import jakarta.servlet.http.HttpServlet; -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; -import jakarta.servlet.http.HttpSession; -import org.apache.commons.text.StringEscapeUtils; - -@WebServlet("/accueil") -public class Accueil extends HttpServlet { - - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { - if (request.getSession(false) == null || request.getSession().getAttribute("email") == null) { - response.sendRedirect(request.getContextPath() + "/login"); - return; - } - HttpSession session = request.getSession(); - String email = StringEscapeUtils.escapeHtml4((String) session.getAttribute("email")); - request.setAttribute("email", email); - request.getRequestDispatcher("/WEB-INF/vue/accueil.jsp").forward(request, response); - } -} diff --git a/WEB-INF/src/controleur/EnvoyerMessage.java b/WEB-INF/src/controleur/EnvoyerMessage.java deleted file mode 100644 index b9c7916827a0e0b5564b8c594d31960d493447db..0000000000000000000000000000000000000000 --- a/WEB-INF/src/controleur/EnvoyerMessage.java +++ /dev/null @@ -1,72 +0,0 @@ -package controleur; - -import jakarta.servlet.annotation.MultipartConfig; -import jakarta.servlet.annotation.WebServlet; -import jakarta.servlet.http.HttpServlet; -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; -import jakarta.servlet.http.Part; -import modele.Message; -import modele.MessageDao; -import jakarta.servlet.ServletException; -import java.io.File; -import java.io.IOException; -import java.time.LocalDateTime; - -@WebServlet("/envoyerMessage") -@MultipartConfig( - maxFileSize = 1024 * 1024 * 5, - maxRequestSize = 1024 * 1024 * 10, - fileSizeThreshold = 0 // comme ça tous les fichiers qui sont normalement des images sont enregistrés sur le serveur -) -public class EnvoyerMessage extends HttpServlet { - private static final String UPLOAD_DIR = "uploads"; - - public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { - if (req.getSession(false) == null || req.getSession().getAttribute("email") == null) { - res.sendRedirect(req.getContextPath() + "/login"); - return; - } - req.getRequestDispatcher("/WEB-INF/vue/listeFil.jsp").forward(req, res); - } - - public void doPost(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { - if (req.getSession(false) == null || req.getSession().getAttribute("email") == null) { - res.sendRedirect(req.getContextPath() + "/login"); - return; - } - String email = (String) req.getSession().getAttribute("email"); - String message = req.getParameter("contenu"); - int filId = (int) req.getSession().getAttribute("filId"); - if (message == null || message.isEmpty()) { - return; - } - - Part filePart = req.getPart("file"); - String fileName = null; - if (filePart != null && filePart.getSize() > 0) { - fileName = getFileName(filePart); - String uploadPath = getServletContext().getRealPath("") + File.separator + UPLOAD_DIR; - File uploadDir = new File(uploadPath); - if (!uploadDir.exists()) { - uploadDir.mkdir(); - } - filePart.write(uploadPath + File.separator + fileName); - } - - Message m = new Message(-1, message, LocalDateTime.now(), filId, email, fileName); - MessageDao messageDao = new MessageDao(); - messageDao.create(m); - res.sendRedirect(req.getContextPath() + "/fil?id=" + filId); - } - - private String getFileName(Part part) { - String contentDisposition = part.getHeader("content-disposition"); - for (String cd : contentDisposition.split(";")) { - if (cd.trim().startsWith("filename")) { - return cd.substring(cd.indexOf('=') + 1).trim().replace("\"", ""); - } - } - return null; - } -} \ No newline at end of file diff --git a/WEB-INF/src/controleur/GetFils.java b/WEB-INF/src/controleur/GetFils.java deleted file mode 100644 index f9fe82c5bb0991cf3814fc1b24b884d6df7668fc..0000000000000000000000000000000000000000 --- a/WEB-INF/src/controleur/GetFils.java +++ /dev/null @@ -1,68 +0,0 @@ -package controleur; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializationFeature; -import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; - -import jakarta.servlet.ServletException; -import jakarta.servlet.annotation.WebServlet; -import jakarta.servlet.http.HttpServlet; -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; -import modele.Abonnement; -import modele.AbonnementDao; -import modele.FilDeDiscussion; -import modele.FilDeDiscussionDAO; -import modele.Message; -import modele.MessageDao; - -//http GET http://localhost:8080/sae/getFils Cookie:"JSESSIONID=ton_session_id" --> F12>Storage>JSESSIONID - -@WebServlet("/getFils") -public class GetFils extends HttpServlet { - @Override - protected void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { - if (req.getSession(false) == null || req.getSession().getAttribute("email") == null) { - res.sendRedirect(req.getContextPath() + "/login"); - return; - } - - String email = (String) req.getSession().getAttribute("email"); - AbonnementDao abonnementDao = new AbonnementDao(); - FilDeDiscussionDAO filDao = new FilDeDiscussionDAO(); - MessageDao messageDao = new MessageDao(); - - try { - List<Abonnement> abonnements = abonnementDao.findAbonnements(email); - List<FilDeDiscussion> fils = new ArrayList<>(); - Map<Integer, List<Message>> messagesMap = new HashMap<>(); - - for (Abonnement abonnement : abonnements) { - FilDeDiscussion fil = filDao.findById(abonnement.getIdFil()); - fils.add(fil); - List<Message> messages = messageDao.findByFil(fil.getId()); - messagesMap.put(fil.getId(), messages); - } - - ObjectMapper objectMapper = new ObjectMapper(); - objectMapper.registerModule(new JavaTimeModule()); - objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); - - Map<String, Object> jsonResponse = new HashMap<>(); - jsonResponse.put("fils", fils); - jsonResponse.put("messages", messagesMap); - - res.setContentType("application/json"); - res.getWriter().write(objectMapper.writeValueAsString(jsonResponse)); - } catch (Exception e) { - res.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); - res.getWriter().write("{\"error\":\"Une erreur est survenue lors de la récupération des données.\"}"); - } - } -} \ No newline at end of file diff --git a/WEB-INF/src/controleur/Like.java b/WEB-INF/src/controleur/Like.java deleted file mode 100644 index d268a999b87bb384070d5352756dfd269a472247..0000000000000000000000000000000000000000 --- a/WEB-INF/src/controleur/Like.java +++ /dev/null @@ -1,34 +0,0 @@ -package controleur; - - -import java.io.IOException; - -import jakarta.servlet.ServletException; -import jakarta.servlet.annotation.WebServlet; -import jakarta.servlet.http.HttpServlet; -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; -import modele.MessageDao; - -@WebServlet("/Like") -public class Like extends HttpServlet { - - @Override - protected void service(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { - String userEmail = (String) req.getSession().getAttribute("email"); - if (userEmail == null) { - res.sendRedirect(req.getContextPath() + "/login"); - return; - } - - int messageId = Integer.parseInt(req.getParameter("messageId")); - MessageDao messageDao = new MessageDao(); - - if (messageDao.updateLike(messageId)) { - res.sendRedirect(req.getHeader("Referer")); - } else { - res.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Erreur lors de la mise à jour du like."); - } - } - -} diff --git a/WEB-INF/src/controleur/Login.java b/WEB-INF/src/controleur/Login.java deleted file mode 100644 index 655e8dbb40cb8152949600a0c312e3086e607715..0000000000000000000000000000000000000000 --- a/WEB-INF/src/controleur/Login.java +++ /dev/null @@ -1,31 +0,0 @@ -package controleur; - -import jakarta.servlet.annotation.WebServlet; -import jakarta.servlet.http.HttpServlet; -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; -import modele.UtilisateurDao; -import jakarta.servlet.ServletException; -import java.io.IOException; -import org.apache.commons.text.StringEscapeUtils; - -@WebServlet("/login") -public class Login extends HttpServlet { - public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { - req.getRequestDispatcher("/WEB-INF/vue/login.jsp").forward(req, res); - } - - public void doPost(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException { - String email = StringEscapeUtils.escapeHtml4(req.getParameter("email")); - String motdepasse = StringEscapeUtils.escapeHtml4(req.getParameter("motdepasse")); - UtilisateurDao udao = new UtilisateurDao(); - if (udao.check(email, motdepasse)) { - System.out.println("Connexion réussie"); - req.getSession().setAttribute("email", email); - res.sendRedirect(req.getContextPath() + "/accueil"); - } else { - System.out.println("Connexion échouée"); - res.sendRedirect(req.getContextPath() + "/login"); - } - } -} \ No newline at end of file diff --git a/WEB-INF/src/modele/DS.java b/WEB-INF/src/modele/DS.java deleted file mode 100644 index f34509cee1b54bec3d01ee14d49f973f613189ac..0000000000000000000000000000000000000000 --- a/WEB-INF/src/modele/DS.java +++ /dev/null @@ -1,29 +0,0 @@ -package modele; - -import java.sql.Connection; -import java.sql.DriverManager; - -public class DS { - public static DS instance = new DS(); - - private DS() { - try { - Class.forName("org.postgresql.Driver"); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - } - - public Connection getConnection() { - String url = "jdbc:postgresql://psqlserv/but2"; - String login = "othemanekhachnaneetu"; - String pwd = "moi"; - Connection con = null; - try { - con = DriverManager.getConnection(url, login, pwd); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - return con; - } -} \ No newline at end of file diff --git a/WEB-INF/src/modele/Message.java b/WEB-INF/src/modele/Message.java deleted file mode 100644 index 4b743b48f9404f27207a14a5b1782e5bd2d6e4a3..0000000000000000000000000000000000000000 --- a/WEB-INF/src/modele/Message.java +++ /dev/null @@ -1,99 +0,0 @@ -package modele; - -import java.time.LocalDateTime; - -import com.fasterxml.jackson.annotation.JsonFormat; - -public class Message { - private int id; - private String contenu; - @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss") - private LocalDateTime datePublication; - private int filId; - private String auteurEmail; - private String fileName; - private boolean likeCount; - - public Message() { - } - - public Message(int id, String contenu, LocalDateTime datePublication, int filId, String auteurEmail, - String fileName) { - this.id = id; - this.contenu = contenu; - this.datePublication = datePublication; - this.filId = filId; - this.auteurEmail = auteurEmail; - this.fileName = fileName; - this.likeCount = false; - } - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getContenu() { - return contenu; - } - - public void setContenu(String contenu) { - this.contenu = contenu; - } - - public LocalDateTime getDatePublication() { - return datePublication; - } - - public void setDatePublication(LocalDateTime datePublication) { - this.datePublication = datePublication; - } - - public int getfilId() { - return filId; - } - - public void setFilId(int filId) { - this.filId = filId; - } - - public String getAuteurEmail() { - return auteurEmail; - } - - public void setAuteurEmail(String auteurEmail) { - this.auteurEmail = auteurEmail; - } - - public String getFileName() { - return fileName; - } - - public void setFileName(String fileName) { - this.fileName = fileName; - } - - public boolean getLikeCount() { - return likeCount; - } - - public void setLikeCount(boolean likeCount) { - this.likeCount = likeCount; - } - - public String afficherLike() { - if (likeCount == true) { - return "Vous avez aimé ce message"; - } - return "Vous n'avez pas aimé ce message"; - } - - @Override - public String toString() { - return "Message{" + "id=" + id + ", contenu=" + contenu + ", datePublication=" + datePublication + ", filId=" - + filId + ", auteurEmail=" + auteurEmail + "like" + afficherLike() +'}'; - } -} diff --git a/WEB-INF/src/modele/MessageDao.java b/WEB-INF/src/modele/MessageDao.java deleted file mode 100644 index 729a4df7f78feec2b99211756bda26f16790e17c..0000000000000000000000000000000000000000 --- a/WEB-INF/src/modele/MessageDao.java +++ /dev/null @@ -1,143 +0,0 @@ -package modele; - -import java.sql.Connection; -import java.sql.PreparedStatement; -import java.sql.ResultSet; -import java.util.List; -import java.util.ArrayList; - -public class MessageDao { - - public Message findMessage(int id) { - Message message = new Message(); - try(Connection con = DS.instance.getConnection()) { - PreparedStatement ps = con.prepareStatement("SELECT * FROM message WHERE id = ?"); - ps.setInt(1, id); - ResultSet rs = ps.executeQuery(); - if (rs.next()) { - message.setId(rs.getInt("id")); - message.setContenu(rs.getString("contenu")); - message.setDatePublication(rs.getTimestamp("datePublication").toLocalDateTime()); - message.setFilId(rs.getInt("filId")); - message.setAuteurEmail(rs.getString("auteurEmail")); - message.setFileName(rs.getString("fileName")); - message.setLikeCount(rs.getBoolean("likeCount")); - } else { - System.out.println("Message inexistant"); - } - } catch (Exception e) { - System.out.println(e.getMessage()); - } - return message; - } - - public List<Message> findAll() { - List<Message> messages = new ArrayList<>(); - try(Connection con = DS.instance.getConnection()) { - PreparedStatement ps = con.prepareStatement("SELECT * FROM message"); - ResultSet rs = ps.executeQuery(); - while (rs.next()) { - Message message = new Message(); - message.setId(rs.getInt("id")); - message.setContenu(rs.getString("contenu")); - message.setDatePublication(rs.getTimestamp("datePublication").toLocalDateTime()); - message.setFilId(rs.getInt("filId")); - message.setAuteurEmail(rs.getString("auteurEmail")); - message.setFileName(rs.getString("fileName")); - message.setLikeCount(rs.getBoolean("likeCount")); - messages.add(message); - } - } catch (Exception e) { - System.out.println(e.getMessage()); - } - return messages; - } - - public List<Message> findByFil(int idFil) { - List<Message> messages = new ArrayList<>(); - try(Connection con = DS.instance.getConnection()) { - PreparedStatement ps = con.prepareStatement("SELECT * FROM message WHERE filId = ?"); - ps.setInt(1, idFil); - ResultSet rs = ps.executeQuery(); - while (rs.next()) { - Message message = new Message(); - message.setId(rs.getInt("id")); - message.setContenu(rs.getString("contenu")); - message.setDatePublication(rs.getTimestamp("datePublication").toLocalDateTime()); - message.setFilId(rs.getInt("filId")); - message.setAuteurEmail(rs.getString("auteurEmail")); - message.setFileName(rs.getString("fileName")); - message.setLikeCount(rs.getBoolean("likeCount")); - messages.add(message); - } - } catch (Exception e) { - System.out.println(e.getMessage()); - } - return messages; - } - - public String findUserName(String email) { - String userName = ""; - try(Connection con = DS.instance.getConnection()) { - PreparedStatement ps = con.prepareStatement("SELECT nom FROM utilisateur WHERE email = ?"); - ps.setString(1, email); - ResultSet rs = ps.executeQuery(); - if (rs.next()) { - userName = rs.getString("nom"); - } else { - System.out.println("Utilisateur inexistant"); - } - } catch (Exception e) { - System.out.println(e.getMessage()); - } - return userName; - } - - public void delete(int id) { - try(Connection con = DS.instance.getConnection()) { - PreparedStatement ps = con.prepareStatement("DELETE FROM message WHERE id = ?"); - ps.setInt(1, id); - ps.executeUpdate(); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - } - - public void create(Message message) { - try(Connection con = DS.instance.getConnection()) { - PreparedStatement ps = con.prepareStatement("INSERT INTO message (contenu, filid, auteuremail, fileName) VALUES (?, ?, ?, ?)"); - ps.setString(1, message.getContenu()); - ps.setInt(2, message.getfilId()); - ps.setString(3, message.getAuteurEmail()); - ps.setString(4, message.getFileName()); - ps.executeUpdate(); - } catch (Exception e) { - System.out.println(e.getMessage()); - } - } - - //cette methode permet de mettre a jour le nombre de like d'un message en fonction de l'action de l'utilisateur (like ou unlike) - public boolean updateLike(int id) { - try(Connection con = DS.instance.getConnection()) { - PreparedStatement ps = con.prepareStatement("SELECT likeCount FROM message WHERE id = ?"); - ps.setInt(1, id); - ResultSet rs = ps.executeQuery(); - if (rs.next()) { - boolean currentLikeStatus = rs.getBoolean("likeCount"); - boolean newLikeStatus = !currentLikeStatus; - ps = con.prepareStatement("UPDATE message SET likeCount = ? WHERE id = ?"); - ps.setBoolean(1, newLikeStatus); - ps.setInt(2, id); - ps.executeUpdate(); - return true; - } else { - System.out.println("Message inexistant"); - return false; - } - } catch (Exception e) { - System.out.println(e.getMessage()); - return false; - } - } - -} diff --git a/WEB-INF/vue/accueil.jsp b/WEB-INF/vue/accueil.jsp deleted file mode 100644 index a8739e7b1ed332496c217eaa129b97b62dc0ad1b..0000000000000000000000000000000000000000 --- a/WEB-INF/vue/accueil.jsp +++ /dev/null @@ -1,70 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> -<%@ page import="modele.UtilisateurDao" %> -<%@ page import="modele.AbonnementDao" %> -<%@ page import="modele.FilDeDiscussion" %> -<%@ page import="modele.FilDeDiscussionDAO" %> -<%@ page import="modele.Abonnement" %> -<%@ page import="java.util.List" %> - -<!DOCTYPE html> -<html lang="fr"> -<head> - <meta charset="UTF-8"> - <meta name="viewport" content="width=device-width, initial-scale=1.0"> - <title>CampusTalk - Accueil</title> - <link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet"> - <link rel="shortcut icon" href="https://www.shareicon.net/data/2016/07/10/119195_chat_512x512.png"> -</head> -<body class="bg-gray-100"> - <nav class="bg-white shadow-md"> - <div class="max-w-7xl mx-auto px-2 sm:px-6 lg:px-8"> - <div class="relative flex items-center justify-between h-16"> - <div class="absolute inset-y-0 left-0 flex items-center sm:hidden"> - <button type="button" class="inline-flex items-center justify-center p-2 rounded-md text-gray-400 hover:text-white hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-inset focus:ring-white" aria-controls="mobile-menu" aria-expanded="false"> - <span class="sr-only">Open main menu</span> - <svg class="block h-6 w-6" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" aria-hidden="true"> - <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16m-7 6h7" /> - </svg> - <svg class="hidden h-6 w-6" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" aria-hidden="true"> - <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" /> - </svg> - </button> - </div> - <div class="flex-1 flex items-center justify-center sm:items-stretch sm:justify-start"> - <div class="flex-shrink-0"> - <a class="text-xl font-bold text-gray-800" href="#">CampusTalk</a> - </div> - <div class="hidden sm:block sm:ml-auto"> - <div class="flex space-x-4"> - <a href="<%= request.getContextPath() %>/logout" class="text-red-600 hover:bg-red-700 hover:text-white px-3 py-2 rounded-md text-sm font-medium">Se déconnecter</a> - </div> - </div> - </div> - </div> - </div> - </nav> - <% UtilisateurDao udao=new UtilisateurDao(); String email=(String) session.getAttribute("email"); String - username=udao.findUtilisateur(email).getNom(); AbonnementDao adao=new AbonnementDao(); List<Abonnement> abonnements - = adao.findAbonnements(email); - FilDeDiscussionDAO fdao = new FilDeDiscussionDAO(); - %> - <div class="max-w-2xl mx-auto mt-12 p-6 bg-white rounded-lg shadow-md"> - <h2 class="text-2xl font-bold mb-4">Bienvenue sur CampusTalk</h2> - <p class="mb-4">Bonjour, <%= username %> !</p> - <p class="mb-4">Vous êtes connecté en tant que <%= email %></p> - <a href="<%= request.getContextPath() %>/listerFil" class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded">Voir les autres fils de discussion</a> - </div> - <div class="max-w-2xl mx-auto mt-8 p-6 bg-white rounded-lg shadow-md"> - <h3 class="text-xl font-bold mb-4">Vos abonnements</h3> - <ul class="list-disc pl-5"> - <% for (Abonnement abo : abonnements) { %> - <li class="mb-2"> - <a href="<%= request.getContextPath() %>/fil?id=<%= abo.getIdFil() %>" class="text-blue-500 hover:underline"> - <%= fdao.findById(abo.getIdFil()).getNom() %> - </a> - </li> - <% } %> - </ul> - </div> -</body> -</html> diff --git a/WEB-INF/vue/creerFil.jsp b/WEB-INF/vue/creerFil.jsp deleted file mode 100644 index 6b141bef85a02b15e6c4fb052674ebb4042c97e8..0000000000000000000000000000000000000000 --- a/WEB-INF/vue/creerFil.jsp +++ /dev/null @@ -1,69 +0,0 @@ -<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> - -<!DOCTYPE html> -<html lang="fr"> -<head> - <meta charset="UTF-8"> - <meta name="viewport" content="width=device-width, initial-scale=1.0"> - <title>CampusTalk - Créer un Fil de Discussion</title> - <link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet"> - <link rel="shortcut icon" href="https://www.shareicon.net/data/2016/07/10/119195_chat_512x512.png"> -</head> -<body class="bg-gray-100"> - <nav class="bg-white shadow-md"> - <div class="max-w-7xl mx-auto px-2 sm:px-6 lg:px-8"> - <div class="relative flex items-center justify-between h-16"> - <div class="absolute inset-y-0 left-0 flex items-center sm:hidden"> - <button type="button" class="inline-flex items-center justify-center p-2 rounded-md text-gray-400 hover:text-white hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-inset focus:ring-white" aria-controls="mobile-menu" aria-expanded="false"> - <span class="sr-only">Open main menu</span> - <svg class="block h-6 w-6" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" aria-hidden="true"> - <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16m-7 6h7" /> - </svg> - <svg class="hidden h-6 w-6" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" aria-hidden="true"> - <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" /> - </svg> - </button> - </div> - <div class="flex-1 flex items-center justify-center sm:items-stretch sm:justify-start"> - <div class="flex-shrink-0"> - <a class="text-xl font-bold text-gray-800" href="#">CampusTalk</a> - </div> - <div class="hidden sm:block sm:ml-auto"> - <div class="flex space-x-4"> - <a href="<%= request.getContextPath() %>/logout" class="text-red-600 hover:bg-red-700 hover:text-white px-3 py-2 rounded-md text-sm font-medium">Se déconnecter</a> - </div> - </div> - </div> - </div> - </div> - </nav> - <div class="container mx-auto px-4 mt-4 text-center"> - <a href="<%= request.getContextPath() %>/listerFil" class="bg-blue-500 text-white px-4 py-2 rounded">Retour aux fils de discussion</a> - </div> - - <% if (request.getAttribute("error") != null) { %> - <div class="max-w-2xl mx-auto mt-4 p-4 bg-red-100 text-red-700 rounded-lg"> - <%= request.getAttribute("error") %> - </div> - <% } %> - - <div class="max-w-2xl mx-auto mt-8 p-6 bg-white rounded-lg shadow-md"> - <h1 class="text-2xl font-bold mb-4 text-center">Créer un nouveau fil de discussion</h1> - <form action="creerFil" method="post" class="mt-4"> - <div class="mb-4"> - <label for="nom" class="block text-gray-700 font-semibold">Nom du fil:</label> - <input type="text" class="w-full p-3 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-400" id="nom" name="nom" required> - </div> - <div class="mb-4"> - <label for="createuremail" class="block text-gray-700 font-semibold">Email du créateur:</label> - <input type="email" class="w-full p-3 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-400" id="createuremail" name="createuremail" required> - </div> - <div class="mb-4"> - <label for="description" class="block text-gray-700 font-semibold">Description:</label> - <textarea class="w-full p-3 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-400" id="description" name="description" rows="3" required></textarea> - </div> - <button type="submit" class="bg-blue-500 text-white px-4 py-2 rounded-lg shadow-md hover:bg-blue-600 transition-colors w-full">Créer</button> - </form> - </div> -</body> -</html> \ No newline at end of file diff --git a/WEB-INF/vue/fil.jsp b/WEB-INF/vue/fil.jsp deleted file mode 100644 index f2a447f42a92bedb450719dedade6f5dc3fccffa..0000000000000000000000000000000000000000 --- a/WEB-INF/vue/fil.jsp +++ /dev/null @@ -1,126 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> -<%@ page import="modele.FilDeDiscussion" %> -<%@ page import="modele.FilDeDiscussionDAO" %> -<%@ page import="modele.Message" %> -<%@ page import="modele.MessageDao" %> -<%@ page import="java.util.List" %> -<%@ page import="java.time.LocalDateTime" %> -<%@ page import="java.time.format.DateTimeFormatter" %> - -<!DOCTYPE html> -<html lang="fr"> -<head> - <meta charset="UTF-8"> - <meta name="viewport" content="width=device-width, initial-scale=1.0"> - <title>CampusTalk - Fil de Discussion</title> - <link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet"> - <link rel="shortcut icon" href="https://www.shareicon.net/data/2016/07/10/119195_chat_512x512.png"> - <style> - .message-container { - transition: background-color 0.3s ease; - } - .message-container:hover { - background-color: #f3f4f6; - } - .message-image { - max-width: 200px; - max-height: 200px; - object-fit: cover; - border-radius: 8px; - } - </style> -</head> -<body class="bg-gray-100 text-gray-900 font-sans"> - <nav class="bg-white shadow-md"> - <div class="container mx-auto px-4 py-2 flex justify-between items-center"> - <a class="text-xl font-bold" href="#">CampusTalk</a> - <div> - <a class="bg-red-500 text-white px-4 py-2 rounded" href="<%= request.getContextPath() %>/logout">Se déconnecter</a> - </div> - </div> - </nav> - - <div class="container mx-auto px-4 mt-4 text-center"> - <a href="<%= request.getContextPath() %>/accueil" class="bg-blue-500 text-white px-4 py-2 rounded">Retour</a> - </div> - - <% - int id = Integer.parseInt(request.getParameter("id")); - session.setAttribute("filId", id); - FilDeDiscussionDAO fddao = new FilDeDiscussionDAO(); - FilDeDiscussion fil = fddao.findById(id); - MessageDao mdao = new MessageDao(); - List<Message> messages = mdao.findByFil(id); - DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd MMM yyyy 'à' HH:mm"); - %> - - <div class="container mx-auto px-4 mt-8"> - <div class="bg-white p-6 rounded-lg shadow-lg"> - <h2 class="text-2xl font-bold mb-4 text-center"><%= fil.getNom() %></h2> - <div class="overflow-y-auto max-h-96" id="messages-box"> - <% for (Message m : messages) { - LocalDateTime datePublication = m.getDatePublication(); - String formattedDate = (datePublication != null) ? datePublication.format(formatter) : "Date non disponible"; - %> - <div class="flex items-start mb-4 message-container"> - <div class="w-10 h-10 rounded-full overflow-hidden"> - <img src="https://www.gravatar.com/avatar/<%= m.getAuteurEmail().hashCode() %>?d=identicon&s=40" alt="Avatar"> - </div> - <div class="ml-4 bg-gray-200 p-4 rounded-lg"> - <h4 class="font-bold"><%= mdao.findUserName(m.getAuteurEmail()) %></h4> - <p class="text-sm text-gray-600"><%= formattedDate %></p> - <p class="mt-2"><%= m.getContenu() %></p> - <% if (m.getFileName() != null) { %> - <img src="<%= request.getContextPath() %>/uploads/<%= m.getFileName() %>" alt="Image" class="mt-2 message-image"> - <% } %> - <div class="mt-2 flex items-center"> - <form action="<%= request.getContextPath() %>/Like" method="post" class="mr-2"> - <input type="hidden" name="messageId" value="<%= m.getId() %>"> - <button type="submit" class="text-blue-500 hover:text-blue-700"> - <% if (m.getLikeCount()) { %> - ❤️ Enlever le like - <% } else { %> - 🤍 Like - <% } %> - </button> - </form> - </div> - </div> - </div> - <% } %> - </div> - - <div class="mt-6 bg-white p-6 rounded-lg shadow-lg"> - <form action="envoyerMessage" method="post" enctype="multipart/form-data"> - <div class="mb-4"> - <label for="contenu" class="block text-gray-700 font-semibold">Votre message :</label> - <textarea class="w-full p-3 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-400" id="contenu" name="contenu" rows="3" required></textarea> - </div> - <div class="mb-4"> - <label for="file" class="block text-gray-700 font-semibold">Ajouter une image :</label> - <div class="flex items-center"> - <input type="file" class="hidden" id="file" name="file"> - <label for="file" class="cursor-pointer bg-blue-500 text-white px-4 py-2 rounded-lg shadow-md hover:bg-blue-600 transition-colors flex items-center"> - <svg class="w-5 h-5 mr-2" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"> - <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"></path> - </svg> - Télécharger - </label> - </div> - </div> - <input type="hidden" name="filId" value="<%= id %>"> - <button type="submit" class="bg-blue-500 text-white px-4 py-2 rounded-lg shadow-md hover:bg-blue-600 transition-colors">Envoyer</button> - </form> - </div> - - </div> - </div> - - <script> - window.onload = function () { - let messagesBox = document.getElementById('messages-box'); - messagesBox.scrollTop = messagesBox.scrollHeight; - }; - </script> -</body> -</html> \ No newline at end of file diff --git a/WEB-INF/vue/listerFil.jsp b/WEB-INF/vue/listerFil.jsp deleted file mode 100644 index 4754c082c73651c7015d820fd49e09bbb896d885..0000000000000000000000000000000000000000 --- a/WEB-INF/vue/listerFil.jsp +++ /dev/null @@ -1,82 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> -<%@ page import="modele.FilDeDiscussion" %> -<%@ page import="modele.FilDeDiscussionDAO" %> -<%@ page import="modele.AbonnementDao" %> -<%@ page import="modele.Abonnement" %> -<%@ page import="java.util.List" %> -<%@ page import="java.util.Set" %> -<%@ page import="java.util.HashSet" %> - -<!DOCTYPE html> -<html lang="fr"> -<head> - <meta charset="UTF-8"> - <meta name="viewport" content="width=device-width, initial-scale=1.0"> - <title>CampusTalk - Fils de Discussion</title> - <link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet"> - <link rel="shortcut icon" href="https://www.shareicon.net/data/2016/07/10/119195_chat_512x512.png"> -</head> -<body class="bg-gray-100"> - <nav class="bg-white shadow-md"> - <div class="max-w-7xl mx-auto px-2 sm:px-6 lg:px-8"> - <div class="relative flex items-center justify-between h-16"> - <div class="absolute inset-y-0 left-0 flex items-center sm:hidden"> - <button type="button" class="inline-flex items-center justify-center p-2 rounded-md text-gray-400 hover:text-white hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-inset focus:ring-white" aria-controls="mobile-menu" aria-expanded="false"> - <span class="sr-only">Open main menu</span> - <svg class="block h-6 w-6" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" aria-hidden="true"> - <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16m-7 6h7" /> - </svg> - <svg class="hidden h-6 w-6" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" aria-hidden="true"> - <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" /> - </svg> - </button> - </div> - <div class="flex-1 flex items-center justify-center sm:items-stretch sm:justify-start"> - <div class="flex-shrink-0"> - <a class="text-xl font-bold text-gray-800" href="#">CampusTalk</a> - </div> - <div class="hidden sm:block sm:ml-auto"> - <div class="flex space-x-4"> - <a href="<%= request.getContextPath() %>/logout" class="text-red-600 hover:bg-red-700 hover:text-white px-3 py-2 rounded-md text-sm font-medium">Se déconnecter</a> - </div> - </div> - </div> - </div> - </div> - </nav> - - <div class="container mx-auto px-4 mt-4 text-center"> - <a href="<%= request.getContextPath() %>/accueil" class="bg-blue-500 text-white px-4 py-2 rounded">Retour à l'accueil</a> - <a href="<%= request.getContextPath() %>/creerFil" class="bg-blue-500 text-white px-4 py-2 rounded">Créer un fil de discussion</a> - </div> - - <div class="max-w-2xl mx-auto mt-8 p-6 bg-white rounded-lg shadow-md"> - <h2 class="text-2xl font-bold mb-4 text-center">Fils de Discussion</h2> - <p class="text-gray-700 mb-4 text-center">(auxquels vous n'êtes pas abonné)</p> - <% - String email = (String) session.getAttribute("email"); - AbonnementDao adao = new AbonnementDao(); - List<Abonnement> abonnements = adao.findAbonnements(email); - Set<Integer> abonnementsIds = new HashSet<>(); - for (Abonnement abonnement : abonnements) { - abonnementsIds.add(abonnement.getIdFil()); - } - - FilDeDiscussionDAO fddao = new FilDeDiscussionDAO(); - for (FilDeDiscussion f : fddao.findAll()) { - if (!abonnementsIds.contains(f.getId())) { - %> - <div class="mb-4 p-4 bg-gray-100 rounded-lg shadow-md"> - <h4 class="font-bold text-lg"><%= f.getNom() %></h4> - <% if (f.getDescription() != null) { %> - <p class="text-gray-700"><%= f.getDescription() %></p> - <% } %> - <a href="<%= request.getContextPath() %>/suivreFil?id=<%= f.getId() %>" class="bg-blue-500 text-white px-4 py-2 rounded mt-2 inline-block">Suivre</a> - </div> - <% - } - } - %> - </div> -</body> -</html> \ No newline at end of file diff --git a/WEB-INF/vue/login.jsp b/WEB-INF/vue/login.jsp deleted file mode 100644 index c1328ac95f367d4fbed97fd541c4ac9ba02c5931..0000000000000000000000000000000000000000 --- a/WEB-INF/vue/login.jsp +++ /dev/null @@ -1,47 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> - -<!DOCTYPE html> -<html lang="fr"> -<head> - <meta charset="UTF-8"> - <meta name="viewport" content="width=device-width, initial-scale=1.0"> - <title>CampusTalk - Connexion</title> - <link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet"> - <link rel="shortcut icon" href="https://www.shareicon.net/data/2016/07/10/119195_chat_512x512.png"> - <style> - body { - background-color: #f8f9fa; - } - </style> -</head> -<body class="bg-gray-100"> - <nav class="bg-white shadow-md"> - <div class="max-w-7xl mx-auto px-2 sm:px-6 lg:px-8"> - <div class="relative flex items-center justify-between h-16"> - <div class="flex-1 flex items-center justify-center sm:items-stretch sm:justify-start"> - <div class="flex-shrink-0"> - <a class="text-xl font-bold text-gray-800" href="#">CampusTalk</a> - </div> - </div> - </div> - </div> - </nav> - <div class="max-w-md mx-auto mt-12 p-6 bg-white rounded-lg shadow-md"> - <h2 class="text-2xl font-bold mb-4 text-center">Bienvenue sur CampusTalk</h2> - <form action="login" method="post"> - <div class="mb-4"> - <label for="email" class="block text-gray-700 font-semibold">Adresse e-mail</label> - <input type="email" class="w-full p-3 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-400" name="email" id="email" placeholder="Entrez votre e-mail" required> - </div> - <div class="mb-4"> - <label for="motdepasse" class="block text-gray-700 font-semibold">Mot de passe</label> - <input type="password" class="w-full p-3 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-400" name="motdepasse" id="motdepasse" placeholder="Entrez votre mot de passe" required> - </div> - <button type="submit" class="bg-blue-500 text-white px-4 py-2 rounded-lg shadow-md hover:bg-blue-600 transition-colors w-full">Se connecter</button> - </form> - <div class="text-center mt-3"> - <p>Vous n'avez pas de compte ? <a href="<%= request.getContextPath() %>/register" class="text-blue-500 hover:underline">S'inscrire</a></p> - </div> - </div> -</body> -</html> \ No newline at end of file diff --git a/WEB-INF/vue/register.jsp b/WEB-INF/vue/register.jsp deleted file mode 100644 index 321f260d65f4815f0f3143457e47888a66de4139..0000000000000000000000000000000000000000 --- a/WEB-INF/vue/register.jsp +++ /dev/null @@ -1,51 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %> - -<!DOCTYPE html> -<html lang="fr"> -<head> - <meta charset="UTF-8"> - <meta name="viewport" content="width=device-width, initial-scale=1.0"> - <title>CampusTalk - Inscription</title> - <link href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css" rel="stylesheet"> - <link rel="shortcut icon" href="https://www.shareicon.net/data/2016/07/10/119195_chat_512x512.png"> -</head> -<body class="bg-gray-100"> - <nav class="bg-white shadow-md"> - <div class="max-w-7xl mx-auto px-2 sm:px-6 lg:px-8"> - <div class="relative flex items-center justify-between h-16"> - <div class="flex-1 flex items-center justify-center sm:items-stretch sm:justify-start"> - <div class="flex-shrink-0"> - <a class="text-xl font-bold text-gray-800" href="#">CampusTalk</a> - </div> - </div> - </div> - </div> - </nav> - <div class="max-w-md mx-auto mt-12 p-6 bg-white rounded-lg shadow-md"> - <h2 class="text-2xl font-bold mb-4 text-center">Inscription</h2> - <% if (request.getAttribute("error") != null) { %> - <div class="bg-red-100 text-red-700 p-4 rounded-lg mb-4"> - <%= request.getAttribute("error") %> - </div> - <% request.removeAttribute("error"); } %> - <form action="register" method="post"> - <div class="mb-4"> - <label for="nom" class="block text-gray-700 font-semibold">Nom</label> - <input type="text" class="w-full p-3 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-400" name="nom" id="nom" placeholder="Entrez votre nom" required> - </div> - <div class="mb-4"> - <label for="email" class="block text-gray-700 font-semibold">Adresse e-mail</label> - <input type="email" class="w-full p-3 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-400" name="email" id="email" placeholder="Entrez votre e-mail" required> - </div> - <div class="mb-4"> - <label for="motdepasse" class="block text-gray-700 font-semibold">Mot de passe</label> - <input type="password" class="w-full p-3 border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-400" name="motdepasse" id="motdepasse" placeholder="Choisissez un mot de passe" required> - </div> - <button type="submit" class="bg-blue-500 text-white px-4 py-2 rounded-lg shadow-md hover:bg-blue-600 transition-colors w-full">S'inscrire</button> - </form> - <div class="text-center mt-3"> - <p>Vous avez déjà un compte ? <a href="<%= request.getContextPath() %>/login" class="text-blue-500 hover:underline">Se connecter</a></p> - </div> - </div> -</body> -</html> \ No newline at end of file diff --git a/META-INF/context.xml b/sae/META-INF/context.xml similarity index 100% rename from META-INF/context.xml rename to sae/META-INF/context.xml diff --git a/sae/README.md b/sae/README.md deleted file mode 100644 index 244d8e92aa883a9dabda225f8e64112cce541b8a..0000000000000000000000000000000000000000 --- a/sae/README.md +++ /dev/null @@ -1,93 +0,0 @@ -# S4.A02.1-H-Adrien.fryson-Othemane.khachnane - - - -## Getting started - -To make it easy for you to get started with GitLab, here's a list of recommended next steps. - -Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)! - -## Add your files - -- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files -- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command: - -``` -cd existing_repo -git remote add origin https://gitlab.univ-lille.fr/othemane.khachnane.etu/s4.a02.1-h-adrien.fryson-othemane.khachnane.git -git branch -M main -git push -uf origin main -``` - -## Integrate with your tools - -- [ ] [Set up project integrations](https://gitlab.univ-lille.fr/othemane.khachnane.etu/s4.a02.1-h-adrien.fryson-othemane.khachnane/-/settings/integrations) - -## Collaborate with your team - -- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/) -- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html) -- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically) -- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/) -- [ ] [Set auto-merge](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html) - -## Test and Deploy - -Use the built-in continuous integration in GitLab. - -- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html) -- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing (SAST)](https://docs.gitlab.com/ee/user/application_security/sast/) -- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html) -- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/) -- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html) - -*** - -# Editing this README - -When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thanks to [makeareadme.com](https://www.makeareadme.com/) for this template. - -## Suggestions for a good README - -Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information. - -## Name -Choose a self-explaining name for your project. - -## Description -Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors. - -## Badges -On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge. - -## Visuals -Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method. - -## Installation -Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection. - -## Usage -Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README. - -## Support -Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc. - -## Roadmap -If you have ideas for releases in the future, it is a good idea to list them in the README. - -## Contributing -State if you are open to contributions and what your requirements are for accepting them. - -For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self. - -You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser. - -## Authors and acknowledgment -Show your appreciation to those who have contributed to the project. - -## License -For open source projects, say how it is licensed. - -## Project status -If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers. diff --git a/sae/WEB-INF/src/.DS_Store b/sae/WEB-INF/src/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..7e26352a1583e69cc3679c58b929a84e089fa611 Binary files /dev/null and b/sae/WEB-INF/src/.DS_Store differ diff --git a/sae/WEB-INF/src/controleur/Accueil.java b/sae/WEB-INF/src/controleur/Accueil.java index 74fef297b74cb46e80bdfbe7df22529623f137ef..1524c2f3bcfe5c353fe7e94f3feff9e6bfe17497 100644 --- a/sae/WEB-INF/src/controleur/Accueil.java +++ b/sae/WEB-INF/src/controleur/Accueil.java @@ -7,6 +7,7 @@ import jakarta.servlet.http.HttpServlet; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpSession; +import org.apache.commons.text.StringEscapeUtils; @WebServlet("/accueil") public class Accueil extends HttpServlet { @@ -17,7 +18,7 @@ public class Accueil extends HttpServlet { return; } HttpSession session = request.getSession(); - String email = (String) session.getAttribute("email"); + String email = StringEscapeUtils.escapeHtml4((String) session.getAttribute("email")); request.setAttribute("email", email); request.getRequestDispatcher("/WEB-INF/vue/accueil.jsp").forward(request, response); } diff --git a/WEB-INF/src/controleur/CreerFil.java b/sae/WEB-INF/src/controleur/CreerFil.java similarity index 61% rename from WEB-INF/src/controleur/CreerFil.java rename to sae/WEB-INF/src/controleur/CreerFil.java index f0cadc3bff5f3de3b8613def91096fdd6dd6215e..098a0ff07a556fa86be32e522715658e079ec699 100644 --- a/WEB-INF/src/controleur/CreerFil.java +++ b/sae/WEB-INF/src/controleur/CreerFil.java @@ -2,19 +2,29 @@ package controleur; import java.time.LocalDateTime; +import jakarta.servlet.annotation.MultipartConfig; import jakarta.servlet.annotation.WebServlet; import jakarta.servlet.http.HttpServlet; import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletResponse; +import jakarta.servlet.http.Part; import modele.FilDeDiscussion; import modele.FilDeDiscussionDAO; import modele.UtilisateurDao; import jakarta.servlet.ServletException; + +import java.io.File; import java.io.IOException; import org.apache.commons.text.StringEscapeUtils; @WebServlet("/creerFil") +@MultipartConfig( + maxFileSize = 1024 * 1024 * 5, + maxRequestSize = 1024 * 1024 * 10, + fileSizeThreshold = 0 +) public class CreerFil extends HttpServlet { + private static final String UPLOAD_DIR = "uploads"; @Override protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { @@ -37,13 +47,37 @@ public class CreerFil extends HttpServlet { req.getRequestDispatcher("/WEB-INF/vue/creerFil.jsp").forward(req, res); return; } + + Part filePart = req.getPart("file"); + String fileName = null; + if (filePart != null && filePart.getSize() > 0) { + fileName = getFileName(filePart); + String uploadPath = getServletContext().getRealPath("") + File.separator + UPLOAD_DIR; + File uploadDir = new File(uploadPath); + if (!uploadDir.exists()) { + uploadDir.mkdir(); + } + filePart.write(uploadPath + File.separator + fileName); + } + f.create(new FilDeDiscussion( -1, nom, LocalDateTime.now(), createuremail, - description + description, + fileName )); res.sendRedirect(req.getContextPath() + "/listerFil"); } + + private String getFileName(Part part) { + String contentDisposition = part.getHeader("content-disposition"); + for (String cd : contentDisposition.split(";")) { + if (cd.trim().startsWith("filename")) { + return cd.substring(cd.indexOf('=') + 1).trim().replace("\"", ""); + } + } + return null; + } } diff --git a/WEB-INF/src/controleur/Fil.java b/sae/WEB-INF/src/controleur/Fil.java similarity index 100% rename from WEB-INF/src/controleur/Fil.java rename to sae/WEB-INF/src/controleur/Fil.java diff --git a/sae/WEB-INF/src/controleur/Like.java b/sae/WEB-INF/src/controleur/Like.java index 6224d8e54ca69df6621d57d328c1c561ca28acd9..d268a999b87bb384070d5352756dfd269a472247 100644 --- a/sae/WEB-INF/src/controleur/Like.java +++ b/sae/WEB-INF/src/controleur/Like.java @@ -24,15 +24,11 @@ public class Like extends HttpServlet { int messageId = Integer.parseInt(req.getParameter("messageId")); MessageDao messageDao = new MessageDao(); - if (req.getParameter("like") != null) { - messageDao.like(messageId, userEmail); + if (messageDao.updateLike(messageId)) { + res.sendRedirect(req.getHeader("Referer")); } else { - messageDao.unlike(messageId, userEmail); + res.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "Erreur lors de la mise à jour du like."); } - - res.sendRedirect(req.getHeader("Referer")); - - //TODO: Implement the like and unlike methods in MessageDao } } diff --git a/WEB-INF/src/controleur/ListerFil.java b/sae/WEB-INF/src/controleur/ListerFil.java similarity index 100% rename from WEB-INF/src/controleur/ListerFil.java rename to sae/WEB-INF/src/controleur/ListerFil.java diff --git a/WEB-INF/src/controleur/Logout.java b/sae/WEB-INF/src/controleur/Logout.java similarity index 100% rename from WEB-INF/src/controleur/Logout.java rename to sae/WEB-INF/src/controleur/Logout.java diff --git a/WEB-INF/src/controleur/Register.java b/sae/WEB-INF/src/controleur/Register.java similarity index 100% rename from WEB-INF/src/controleur/Register.java rename to sae/WEB-INF/src/controleur/Register.java diff --git a/WEB-INF/src/controleur/SuivreFil.java b/sae/WEB-INF/src/controleur/SuivreFil.java similarity index 100% rename from WEB-INF/src/controleur/SuivreFil.java rename to sae/WEB-INF/src/controleur/SuivreFil.java diff --git a/WEB-INF/src/modele/Abonnement.java b/sae/WEB-INF/src/modele/Abonnement.java similarity index 100% rename from WEB-INF/src/modele/Abonnement.java rename to sae/WEB-INF/src/modele/Abonnement.java diff --git a/WEB-INF/src/modele/AbonnementDao.java b/sae/WEB-INF/src/modele/AbonnementDao.java similarity index 100% rename from WEB-INF/src/modele/AbonnementDao.java rename to sae/WEB-INF/src/modele/AbonnementDao.java diff --git a/sae/WEB-INF/src/modele/DS.java b/sae/WEB-INF/src/modele/DS.java index f34509cee1b54bec3d01ee14d49f973f613189ac..a9b4271dd2507834c908aca57493cb0f2182af86 100644 --- a/sae/WEB-INF/src/modele/DS.java +++ b/sae/WEB-INF/src/modele/DS.java @@ -15,9 +15,9 @@ public class DS { } public Connection getConnection() { - String url = "jdbc:postgresql://psqlserv/but2"; - String login = "othemanekhachnaneetu"; - String pwd = "moi"; + String url = "jdbc:postgresql://localhost:5432/postgres"; + String login = "postgres"; + String pwd = ""; Connection con = null; try { con = DriverManager.getConnection(url, login, pwd); diff --git a/WEB-INF/src/modele/FilDeDiscussion.java b/sae/WEB-INF/src/modele/FilDeDiscussion.java similarity index 83% rename from WEB-INF/src/modele/FilDeDiscussion.java rename to sae/WEB-INF/src/modele/FilDeDiscussion.java index 92c5c3e8b13677975ff8cbf4b37c1a2f85784b9f..8fa5b8be34067f86e224f39a7760bc939555454e 100644 --- a/WEB-INF/src/modele/FilDeDiscussion.java +++ b/sae/WEB-INF/src/modele/FilDeDiscussion.java @@ -8,16 +8,18 @@ public class FilDeDiscussion { private LocalDateTime dateCreation; private String createurEmail; private String description; + private String logo; public FilDeDiscussion() { } - public FilDeDiscussion(int id, String nom, LocalDateTime dateCreation, String createurEmail, String description) { + public FilDeDiscussion(int id, String nom, LocalDateTime dateCreation, String createurEmail, String description, String logo) { this.id = id; this.nom = nom; this.dateCreation = dateCreation; this.createurEmail = createurEmail; this.description = description; + this.logo = logo; } public int getId() { @@ -59,4 +61,12 @@ public class FilDeDiscussion { public void setDescription(String description) { this.description = description; } + + public String getLogo() { + return logo; + } + + public void setLogo(String logo) { + this.logo = logo; + } } diff --git a/WEB-INF/src/modele/FilDeDiscussionDAO.java b/sae/WEB-INF/src/modele/FilDeDiscussionDAO.java similarity index 92% rename from WEB-INF/src/modele/FilDeDiscussionDAO.java rename to sae/WEB-INF/src/modele/FilDeDiscussionDAO.java index 4ae597e13c557fc4e6112c13a4363f2b00153440..38a0e5464cce87d122b47721cffae18b6c2e4926 100644 --- a/WEB-INF/src/modele/FilDeDiscussionDAO.java +++ b/sae/WEB-INF/src/modele/FilDeDiscussionDAO.java @@ -20,6 +20,7 @@ public class FilDeDiscussionDAO { f.setDateCreation(rs.getTimestamp("datecreation").toLocalDateTime()); f.setCreateurEmail(rs.getString("createuremail")); f.setDescription(rs.getString("description")); + f.setLogo(rs.getString("logo")); } else { System.out.println("Fil de discussion inexistant"); } @@ -31,10 +32,11 @@ public class FilDeDiscussionDAO { public void create(FilDeDiscussion filDeDiscussion) { try (Connection con = DS.instance.getConnection()) { - PreparedStatement pstmt = con.prepareStatement("INSERT INTO filDeDiscussion (nom, createuremail, description) VALUES (?, ?, ?)"); + PreparedStatement pstmt = con.prepareStatement("INSERT INTO filDeDiscussion (nom, createuremail, description, logo) VALUES (?, ?, ?, ?)"); pstmt.setString(1, filDeDiscussion.getNom()); pstmt.setString(2, filDeDiscussion.getCreateurEmail()); pstmt.setString(3, filDeDiscussion.getDescription()); + pstmt.setString(4, filDeDiscussion.getLogo()); pstmt.executeUpdate(); } catch (Exception e) { System.err.println(e.getMessage()); @@ -53,6 +55,7 @@ public class FilDeDiscussionDAO { f.setDateCreation(rs.getTimestamp("datecreation").toLocalDateTime()); f.setCreateurEmail(rs.getString("createuremail")); f.setDescription(rs.getString("description")); + f.setLogo(rs.getString("logo")); filsDeDiscussion.add(f); } } catch (Exception e) { diff --git a/sae/WEB-INF/src/modele/Message.java b/sae/WEB-INF/src/modele/Message.java index 6bdb0bb2c450b58c4c220d511453e9d00549cb62..4b743b48f9404f27207a14a5b1782e5bd2d6e4a3 100644 --- a/sae/WEB-INF/src/modele/Message.java +++ b/sae/WEB-INF/src/modele/Message.java @@ -12,7 +12,7 @@ public class Message { private int filId; private String auteurEmail; private String fileName; - private int likeCount; + private boolean likeCount; public Message() { } @@ -25,7 +25,7 @@ public class Message { this.filId = filId; this.auteurEmail = auteurEmail; this.fileName = fileName; - this.likeCount = 0; + this.likeCount = false; } public int getId() { @@ -76,17 +76,24 @@ public class Message { this.fileName = fileName; } - public int getLikeCount() { + public boolean getLikeCount() { return likeCount; } - public void setLikeCount(int likeCount) { + public void setLikeCount(boolean likeCount) { this.likeCount = likeCount; } + public String afficherLike() { + if (likeCount == true) { + return "Vous avez aimé ce message"; + } + return "Vous n'avez pas aimé ce message"; + } + @Override public String toString() { return "Message{" + "id=" + id + ", contenu=" + contenu + ", datePublication=" + datePublication + ", filId=" - + filId + ", auteurEmail=" + auteurEmail + "like" + likeCount + '}'; + + filId + ", auteurEmail=" + auteurEmail + "like" + afficherLike() +'}'; } } diff --git a/sae/WEB-INF/src/modele/MessageDao.java b/sae/WEB-INF/src/modele/MessageDao.java index 4294c7bb736e8ba8f42c8834ef876ed3b52e76f0..729a4df7f78feec2b99211756bda26f16790e17c 100644 --- a/sae/WEB-INF/src/modele/MessageDao.java +++ b/sae/WEB-INF/src/modele/MessageDao.java @@ -21,7 +21,7 @@ public class MessageDao { message.setFilId(rs.getInt("filId")); message.setAuteurEmail(rs.getString("auteurEmail")); message.setFileName(rs.getString("fileName")); - message.setLikeCount(rs.getInt("likeCount")); + message.setLikeCount(rs.getBoolean("likeCount")); } else { System.out.println("Message inexistant"); } @@ -44,7 +44,7 @@ public class MessageDao { message.setFilId(rs.getInt("filId")); message.setAuteurEmail(rs.getString("auteurEmail")); message.setFileName(rs.getString("fileName")); - message.setLikeCount(rs.getInt("likeCount")); + message.setLikeCount(rs.getBoolean("likeCount")); messages.add(message); } } catch (Exception e) { @@ -67,7 +67,7 @@ public class MessageDao { message.setFilId(rs.getInt("filId")); message.setAuteurEmail(rs.getString("auteurEmail")); message.setFileName(rs.getString("fileName")); - message.setLikeCount(rs.getInt("likeCount")); + message.setLikeCount(rs.getBoolean("likeCount")); messages.add(message); } } catch (Exception e) { @@ -115,37 +115,29 @@ public class MessageDao { System.out.println(e.getMessage()); } } - - public boolean like(int id, String email) { - boolean liked = false; - try(Connection con = DS.instance.getConnection()) { - PreparedStatement ps = con.prepareStatement("SELECT * FROM like WHERE messageid = ? AND auteuremail = ?"); - ps.setInt(1, id); - ps.setString(2, email); - ResultSet rs = ps.executeQuery(); - if (rs.next()) { - liked = true; - } - } catch (Exception e) { - System.out.println(e.getMessage()); - } - return liked; - } - - public boolean unlike(int id, String email) { - boolean unliked = false; + + //cette methode permet de mettre a jour le nombre de like d'un message en fonction de l'action de l'utilisateur (like ou unlike) + public boolean updateLike(int id) { try(Connection con = DS.instance.getConnection()) { - PreparedStatement ps = con.prepareStatement("SELECT * FROM like WHERE messageid = ? AND auteuremail = ?"); + PreparedStatement ps = con.prepareStatement("SELECT likeCount FROM message WHERE id = ?"); ps.setInt(1, id); - ps.setString(2, email); ResultSet rs = ps.executeQuery(); if (rs.next()) { - unliked = true; + boolean currentLikeStatus = rs.getBoolean("likeCount"); + boolean newLikeStatus = !currentLikeStatus; + ps = con.prepareStatement("UPDATE message SET likeCount = ? WHERE id = ?"); + ps.setBoolean(1, newLikeStatus); + ps.setInt(2, id); + ps.executeUpdate(); + return true; + } else { + System.out.println("Message inexistant"); + return false; } } catch (Exception e) { System.out.println(e.getMessage()); + return false; } - return unliked; } } diff --git a/WEB-INF/src/modele/Utilisateur.java b/sae/WEB-INF/src/modele/Utilisateur.java similarity index 100% rename from WEB-INF/src/modele/Utilisateur.java rename to sae/WEB-INF/src/modele/Utilisateur.java diff --git a/WEB-INF/src/modele/UtilisateurDao.java b/sae/WEB-INF/src/modele/UtilisateurDao.java similarity index 100% rename from WEB-INF/src/modele/UtilisateurDao.java rename to sae/WEB-INF/src/modele/UtilisateurDao.java diff --git a/sae/compilation.md b/sae/compilation.md deleted file mode 100644 index ed1bf26d20b435da9ae80c9eed39cd9ea782f165..0000000000000000000000000000000000000000 --- a/sae/compilation.md +++ /dev/null @@ -1 +0,0 @@ -javac -d WEB-INF/classes -cp ../../lib/servlet-api.jar:../../lib/commons-lang3-3.17.0.jar:../../lib/commons-text-1.13.0.jar:../../lib/jackson-datatype-jsr310-2.13.0.jar:../../lib/jackson-annotations-2.15.3.jar:../../lib/jackson-core-2.15.3.jar:../../lib/jackson-databind-2.15.3.jar:../../lib/jackson-dataformat-xml-2.15.3.jar WEB-INF/src/controleur/*.java WEB-INF/src/modele/*.java diff --git a/sae/uploads/Abr.png b/sae/uploads/Abr.png deleted file mode 100644 index 104b2328ee7164628311b8ee28dc54376ec0b75d..0000000000000000000000000000000000000000 Binary files a/sae/uploads/Abr.png and /dev/null differ diff --git a/sae/script.sql b/script.sql similarity index 99% rename from sae/script.sql rename to script.sql index 1932907db6070b58bda405f1a5072841cd6f8e15..ba4d366b919469baaf0cc0afc2435dd920b678c7 100644 --- a/sae/script.sql +++ b/script.sql @@ -17,6 +17,7 @@ CREATE TABLE FilDeDiscussion ( dateCreation TIMESTAMP DEFAULT CURRENT_TIMESTAMP, createurEmail VARCHAR(100), description TEXT, + logo VARCHAR(255), CONSTRAINT pk_fil PRIMARY KEY (id), CONSTRAINT fk_createur FOREIGN KEY (createurEmail) REFERENCES Utilisateur(email) ON DELETE SET NULL diff --git a/uploads/Abr.png b/uploads/Abr.png deleted file mode 100644 index 104b2328ee7164628311b8ee28dc54376ec0b75d..0000000000000000000000000000000000000000 Binary files a/uploads/Abr.png and /dev/null differ