diff --git a/pom.xml b/pom.xml index ed80db0..be1615d 100644 --- a/pom.xml +++ b/pom.xml @@ -60,6 +60,8 @@ + + org.springframework.boot spring-boot-devtools diff --git a/src/main/java/com/cristobalbernal/foro/controlador/Controlador.java b/src/main/java/com/cristobalbernal/foro/controlador/Controlador.java new file mode 100644 index 0000000..9485b56 --- /dev/null +++ b/src/main/java/com/cristobalbernal/foro/controlador/Controlador.java @@ -0,0 +1,10 @@ +package com.cristobalbernal.foro.controlador; + +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.GetMapping; + +@Controller +public class Controlador { + +} diff --git a/src/main/java/com/cristobalbernal/foro/controlador/controlador.java b/src/main/java/com/cristobalbernal/foro/controlador/controlador.java deleted file mode 100644 index 439235d..0000000 --- a/src/main/java/com/cristobalbernal/foro/controlador/controlador.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.cristobalbernal.foro.controlador; - -import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.servlet.support.ServletUriComponentsBuilder; - -import java.net.MalformedURLException; -import java.net.URL; -@Controller -public class controlador { - @GetMapping({"/","","home","/inicio","/index"}) - public String welcome(Model model) throws MalformedURLException { - final String currentURL = ServletUriComponentsBuilder.fromCurrentContextPath().build().toUriString(); - URL requestURL = new URL(currentURL); - model.addAttribute("mensaje","Ramoncin"); - String dominio = requestURL.getHost(); - int x = dominio.indexOf("."); - int y = dominio.indexOf("."); - String conDominio = dominio.substring(0,x); - model.addAttribute("dominio",conDominio); - return "index"; - } -} diff --git a/src/main/java/com/cristobalbernal/foro/entidades/CategoriaForoEntity.java b/src/main/java/com/cristobalbernal/foro/entidades/CategoriaForoEntity.java deleted file mode 100644 index de290d1..0000000 --- a/src/main/java/com/cristobalbernal/foro/entidades/CategoriaForoEntity.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.cristobalbernal.foro.entidades; - -import jakarta.persistence.*; - -@Entity -@Table(name = "categoria_foro", schema = "foro", catalog = "") -public class CategoriaForoEntity { - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Id - @Column(name = "id", nullable = false) - private int id; - @Basic - @Column(name = "name", nullable = true, length = 45) - private String name; - @Basic - @Column(name = "descripcion", nullable = true, length = 45) - private String descripcion; - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getDescripcion() { - return descripcion; - } - - public void setDescripcion(String descripcion) { - this.descripcion = descripcion; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - CategoriaForoEntity that = (CategoriaForoEntity) o; - - if (id != that.id) return false; - if (name != null ? !name.equals(that.name) : that.name != null) return false; - if (descripcion != null ? !descripcion.equals(that.descripcion) : that.descripcion != null) return false; - - return true; - } - - @Override - public int hashCode() { - int result = id; - result = 31 * result + (name != null ? name.hashCode() : 0); - result = 31 * result + (descripcion != null ? descripcion.hashCode() : 0); - return result; - } -} diff --git a/src/main/java/com/cristobalbernal/foro/entidades/ForoEntity.java b/src/main/java/com/cristobalbernal/foro/entidades/ForoEntity.java deleted file mode 100644 index 7f6b1f7..0000000 --- a/src/main/java/com/cristobalbernal/foro/entidades/ForoEntity.java +++ /dev/null @@ -1,105 +0,0 @@ -package com.cristobalbernal.foro.entidades; - -import jakarta.persistence.*; - -import java.sql.Timestamp; - -@Entity -@Table(name = "foro", schema = "foro", catalog = "") -public class ForoEntity { - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Id - @Column(name = "id", nullable = false) - private int id; - @Basic - @Column(name = "titulo", nullable = true, length = 150) - private String titulo; - @Basic - @Column(name = "descripcion", nullable = true, length = 150) - private String descripcion; - @Basic - @Column(name = "fechaYHora", nullable = true) - private Timestamp fechaYHora; - @Basic - @Column(name = "imagen_id", nullable = false) - private int imagenId; - @Basic - @Column(name = "categoria_foro_id", nullable = false) - private int categoriaForoId; - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getTitulo() { - return titulo; - } - - public void setTitulo(String titulo) { - this.titulo = titulo; - } - - public String getDescripcion() { - return descripcion; - } - - public void setDescripcion(String descripcion) { - this.descripcion = descripcion; - } - - public Timestamp getFechaYHora() { - return fechaYHora; - } - - public void setFechaYHora(Timestamp fechaYHora) { - this.fechaYHora = fechaYHora; - } - - public int getImagenId() { - return imagenId; - } - - public void setImagenId(int imagenId) { - this.imagenId = imagenId; - } - - public int getCategoriaForoId() { - return categoriaForoId; - } - - public void setCategoriaForoId(int categoriaForoId) { - this.categoriaForoId = categoriaForoId; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - ForoEntity that = (ForoEntity) o; - - if (id != that.id) return false; - if (imagenId != that.imagenId) return false; - if (categoriaForoId != that.categoriaForoId) return false; - if (titulo != null ? !titulo.equals(that.titulo) : that.titulo != null) return false; - if (descripcion != null ? !descripcion.equals(that.descripcion) : that.descripcion != null) return false; - if (fechaYHora != null ? !fechaYHora.equals(that.fechaYHora) : that.fechaYHora != null) return false; - - return true; - } - - @Override - public int hashCode() { - int result = id; - result = 31 * result + (titulo != null ? titulo.hashCode() : 0); - result = 31 * result + (descripcion != null ? descripcion.hashCode() : 0); - result = 31 * result + (fechaYHora != null ? fechaYHora.hashCode() : 0); - result = 31 * result + imagenId; - result = 31 * result + categoriaForoId; - return result; - } -} diff --git a/src/main/java/com/cristobalbernal/foro/entidades/RespuestasEntity.java b/src/main/java/com/cristobalbernal/foro/entidades/RespuestasEntity.java deleted file mode 100644 index c77f0cc..0000000 --- a/src/main/java/com/cristobalbernal/foro/entidades/RespuestasEntity.java +++ /dev/null @@ -1,105 +0,0 @@ -package com.cristobalbernal.foro.entidades; - -import jakarta.persistence.*; - -import java.sql.Timestamp; - -@Entity -@Table(name = "respuestas", schema = "foro", catalog = "") -public class RespuestasEntity { - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Id - @Column(name = "id", nullable = false) - private int id; - @Basic - @Column(name = "Post", nullable = true, length = 45) - private String post; - @Basic - @Column(name = "fechaYHora", nullable = true) - private Timestamp fechaYHora; - @Basic - @Column(name = "Respuestas_id", nullable = false) - private int respuestasId; - @Basic - @Column(name = "users_id", nullable = false) - private int usersId; - @Basic - @Column(name = "Foro_id", nullable = false) - private int foroId; - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getPost() { - return post; - } - - public void setPost(String post) { - this.post = post; - } - - public Timestamp getFechaYHora() { - return fechaYHora; - } - - public void setFechaYHora(Timestamp fechaYHora) { - this.fechaYHora = fechaYHora; - } - - public int getRespuestasId() { - return respuestasId; - } - - public void setRespuestasId(int respuestasId) { - this.respuestasId = respuestasId; - } - - public int getUsersId() { - return usersId; - } - - public void setUsersId(int usersId) { - this.usersId = usersId; - } - - public int getForoId() { - return foroId; - } - - public void setForoId(int foroId) { - this.foroId = foroId; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - RespuestasEntity that = (RespuestasEntity) o; - - if (id != that.id) return false; - if (respuestasId != that.respuestasId) return false; - if (usersId != that.usersId) return false; - if (foroId != that.foroId) return false; - if (post != null ? !post.equals(that.post) : that.post != null) return false; - if (fechaYHora != null ? !fechaYHora.equals(that.fechaYHora) : that.fechaYHora != null) return false; - - return true; - } - - @Override - public int hashCode() { - int result = id; - result = 31 * result + (post != null ? post.hashCode() : 0); - result = 31 * result + (fechaYHora != null ? fechaYHora.hashCode() : 0); - result = 31 * result + respuestasId; - result = 31 * result + usersId; - result = 31 * result + foroId; - return result; - } -} diff --git a/src/main/java/com/cristobalbernal/foro/entidades/UsersEntity.java b/src/main/java/com/cristobalbernal/foro/entidades/UsersEntity.java deleted file mode 100644 index 48d9fe9..0000000 --- a/src/main/java/com/cristobalbernal/foro/entidades/UsersEntity.java +++ /dev/null @@ -1,143 +0,0 @@ -package com.cristobalbernal.foro.entidades; - -import jakarta.persistence.*; - -@Entity -@Table(name = "users", schema = "foro", catalog = "") -public class UsersEntity { - @GeneratedValue(strategy = GenerationType.IDENTITY) - @Id - @Column(name = "id", nullable = false) - private int id; - @Basic - @Column(name = "name", nullable = true, length = 45) - private String name; - @Basic - @Column(name = "firstname", nullable = true, length = 45) - private String firstname; - @Basic - @Column(name = "secondname", nullable = true, length = 45) - private String secondname; - @Basic - @Column(name = "password", nullable = true, length = 45) - private String password; - @Basic - @Column(name = "email", nullable = true, length = 45) - private String email; - @Basic - @Column(name = "username", nullable = true, length = 45) - private String username; - @Basic - @Column(name = "urlImgen", nullable = true, length = 150) - private String urlImgen; - @Basic - @Column(name = "tipoPrivilegios", nullable = true) - private Byte tipoPrivilegios; - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getFirstname() { - return firstname; - } - - public void setFirstname(String firstname) { - this.firstname = firstname; - } - - public String getSecondname() { - return secondname; - } - - public void setSecondname(String secondname) { - this.secondname = secondname; - } - - public String getPassword() { - return password; - } - - public void setPassword(String password) { - this.password = password; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public String getUsername() { - return username; - } - - public void setUsername(String username) { - this.username = username; - } - - public String getUrlImgen() { - return urlImgen; - } - - public void setUrlImgen(String urlImgen) { - this.urlImgen = urlImgen; - } - - public Byte getTipoPrivilegios() { - return tipoPrivilegios; - } - - public void setTipoPrivilegios(Byte tipoPrivilegios) { - this.tipoPrivilegios = tipoPrivilegios; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - UsersEntity that = (UsersEntity) o; - - if (id != that.id) return false; - if (name != null ? !name.equals(that.name) : that.name != null) return false; - if (firstname != null ? !firstname.equals(that.firstname) : that.firstname != null) return false; - if (secondname != null ? !secondname.equals(that.secondname) : that.secondname != null) return false; - if (password != null ? !password.equals(that.password) : that.password != null) return false; - if (email != null ? !email.equals(that.email) : that.email != null) return false; - if (username != null ? !username.equals(that.username) : that.username != null) return false; - if (urlImgen != null ? !urlImgen.equals(that.urlImgen) : that.urlImgen != null) return false; - if (tipoPrivilegios != null ? !tipoPrivilegios.equals(that.tipoPrivilegios) : that.tipoPrivilegios != null) - return false; - - return true; - } - - @Override - public int hashCode() { - int result = id; - result = 31 * result + (name != null ? name.hashCode() : 0); - result = 31 * result + (firstname != null ? firstname.hashCode() : 0); - result = 31 * result + (secondname != null ? secondname.hashCode() : 0); - result = 31 * result + (password != null ? password.hashCode() : 0); - result = 31 * result + (email != null ? email.hashCode() : 0); - result = 31 * result + (username != null ? username.hashCode() : 0); - result = 31 * result + (urlImgen != null ? urlImgen.hashCode() : 0); - result = 31 * result + (tipoPrivilegios != null ? tipoPrivilegios.hashCode() : 0); - return result; - } -}