diff --git a/src/main/java/com/gabriel_torelo/game_list/entities/Game.java b/src/main/java/com/gabriel_torelo/game_list/entities/Game.java new file mode 100644 index 0000000..96cf8d2 --- /dev/null +++ b/src/main/java/com/gabriel_torelo/game_list/entities/Game.java @@ -0,0 +1,142 @@ +package com.gabriel_torelo.game_list.entities; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.Table; + +@Entity +@Table(name = "tb_game") +public class Game { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + private Long id; + private String title; + + @Column(name = "game_year") + private Integer year; + private String gender; + private String platforms; + private Double score; + private String imgUrl; + private String shortDescription; + + @Column(columnDefinition = "LONGTEXT") + private String longDescription; + + public Game() { + } + + public Game(Long id, String title, Integer year, String gender, String platforms, Double score, String imgUrl, + String shortDescription, String longDescription) { + this.id = id; + this.title = title; + this.year = year; + this.gender = gender; + this.platforms = platforms; + this.score = score; + this.imgUrl = imgUrl; + this.shortDescription = shortDescription; + this.longDescription = longDescription; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public Integer getYear() { + return year; + } + + public void setYear(Integer year) { + this.year = year; + } + + public String getGender() { + return gender; + } + + public void setGender(String gender) { + this.gender = gender; + } + + public String getPlatforms() { + return platforms; + } + + public void setPlatforms(String platforms) { + this.platforms = platforms; + } + + public Double getScore() { + return score; + } + + public void setScore(Double score) { + this.score = score; + } + + public String getImgUrl() { + return imgUrl; + } + + public void setImgUrl(String imgUrl) { + this.imgUrl = imgUrl; + } + + public String getShortDescription() { + return shortDescription; + } + + public void setShortDescription(String shortDescription) { + this.shortDescription = shortDescription; + } + + public String getLongDescription() { + return longDescription; + } + + public void setLongDescription(String longDescription) { + this.longDescription = longDescription; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((id == null) ? 0 : id.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + Game other = (Game) obj; + if (id == null) { + if (other.id != null) + return false; + } else if (!id.equals(other.id)) + return false; + return true; + } +} diff --git a/src/main/resources/application-test.properties b/src/main/resources/application-test.properties new file mode 100644 index 0000000..9e61b4b --- /dev/null +++ b/src/main/resources/application-test.properties @@ -0,0 +1,12 @@ +# H2 Connection +spring.datasource.url=jdbc:h2:mem:testdb +spring.datasource.username=sa +spring.datasource.password= + +# H2 Client +spring.h2.console.enabled=true +spring.h2.console.path=/h2-console + +# Show SQL +spring.jpa.show-sql=true +spring.jpa.properties.hibernate.format_sql=true diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 8b13789..e560631 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1 +1,4 @@ +spring.profiles.active=${APP_PROFILE:test} +spring.jpa.open-in-view=false +cors.origins=${CORS_ORIGINS:http://localhost:5173,http://localhost:3000}