From 796f932771ba0794c8b1da4fb1d159a8e5453d3d Mon Sep 17 00:00:00 2001 From: Firestone82 Date: Sat, 3 Feb 2024 22:28:36 +0100 Subject: [PATCH] Update Took 6 minutes --- .../api/table/enemy/model/dto/EnemyDTO.java | 3 +- .../schematic/location/LocationRepo.java | 6 ---- .../location/model/dto/LocationDTO.java | 2 +- .../location/model/dto/LocationDoorDTO.java | 1 + .../location/model/dto/LocationPartDTO.java | 2 ++ .../location/model/dto/LocationPathDTO.java | 1 + .../location/model/dto/LocationStartDTO.java | 1 + .../schematic/obstacle/ObstacleRepo.java | 5 --- .../api/table/schematic/part/model/Part.java | 5 --- .../api/table/schematic/path/Path.java | 31 ------------------- 10 files changed, 7 insertions(+), 50 deletions(-) delete mode 100644 src/main/java/cz/trailsthroughshadows/api/table/schematic/path/Path.java diff --git a/src/main/java/cz/trailsthroughshadows/api/table/enemy/model/dto/EnemyDTO.java b/src/main/java/cz/trailsthroughshadows/api/table/enemy/model/dto/EnemyDTO.java index 6b3b315..b89acaf 100644 --- a/src/main/java/cz/trailsthroughshadows/api/table/enemy/model/dto/EnemyDTO.java +++ b/src/main/java/cz/trailsthroughshadows/api/table/enemy/model/dto/EnemyDTO.java @@ -6,7 +6,6 @@ import cz.trailsthroughshadows.api.table.enemy.model.EnemyAction; import jakarta.persistence.*; import lombok.Data; -import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; import java.util.ArrayList; @@ -16,7 +15,7 @@ @Entity @NoArgsConstructor @Table(name = "Enemy") -public class EnemyDTO implements Cloneable { +public class EnemyDTO implements Cloneable { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) diff --git a/src/main/java/cz/trailsthroughshadows/api/table/schematic/location/LocationRepo.java b/src/main/java/cz/trailsthroughshadows/api/table/schematic/location/LocationRepo.java index 6c014a9..5a17b57 100644 --- a/src/main/java/cz/trailsthroughshadows/api/table/schematic/location/LocationRepo.java +++ b/src/main/java/cz/trailsthroughshadows/api/table/schematic/location/LocationRepo.java @@ -9,10 +9,4 @@ public interface LocationRepo extends JpaRepository { - @Override - List findAll(); - - @Override - Optional findById(Integer id); - } diff --git a/src/main/java/cz/trailsthroughshadows/api/table/schematic/location/model/dto/LocationDTO.java b/src/main/java/cz/trailsthroughshadows/api/table/schematic/location/model/dto/LocationDTO.java index c33c980..2b4239b 100644 --- a/src/main/java/cz/trailsthroughshadows/api/table/schematic/location/model/dto/LocationDTO.java +++ b/src/main/java/cz/trailsthroughshadows/api/table/schematic/location/model/dto/LocationDTO.java @@ -36,7 +36,7 @@ public class LocationDTO { @Column(name = "description", columnDefinition = "TEXT") public String description; - @OneToMany(mappedBy = "key.idLocation", cascade = CascadeType.ALL, fetch = FetchType.LAZY) + @OneToMany(mappedBy = "key.idLocation", cascade = CascadeType.ALL, fetch = FetchType.EAGER) public List parts; @OneToMany(mappedBy = "idLocation", cascade = CascadeType.ALL, fetch = FetchType.LAZY) diff --git a/src/main/java/cz/trailsthroughshadows/api/table/schematic/location/model/dto/LocationDoorDTO.java b/src/main/java/cz/trailsthroughshadows/api/table/schematic/location/model/dto/LocationDoorDTO.java index 3aaddc3..a4ec74d 100644 --- a/src/main/java/cz/trailsthroughshadows/api/table/schematic/location/model/dto/LocationDoorDTO.java +++ b/src/main/java/cz/trailsthroughshadows/api/table/schematic/location/model/dto/LocationDoorDTO.java @@ -27,4 +27,5 @@ public class LocationDoorDTO implements Serializable { @Id private int idHex; + } \ No newline at end of file diff --git a/src/main/java/cz/trailsthroughshadows/api/table/schematic/location/model/dto/LocationPartDTO.java b/src/main/java/cz/trailsthroughshadows/api/table/schematic/location/model/dto/LocationPartDTO.java index 267a8be..23c7f68 100644 --- a/src/main/java/cz/trailsthroughshadows/api/table/schematic/location/model/dto/LocationPartDTO.java +++ b/src/main/java/cz/trailsthroughshadows/api/table/schematic/location/model/dto/LocationPartDTO.java @@ -28,10 +28,12 @@ public class LocationPartDTO { @Embeddable @Data public static class LocationPartId implements Serializable { + @Column(name = "idLocation") private int idLocation; @Column(name = "idPart") private int idPart; + } } diff --git a/src/main/java/cz/trailsthroughshadows/api/table/schematic/location/model/dto/LocationPathDTO.java b/src/main/java/cz/trailsthroughshadows/api/table/schematic/location/model/dto/LocationPathDTO.java index 263fa76..f6848b2 100644 --- a/src/main/java/cz/trailsthroughshadows/api/table/schematic/location/model/dto/LocationPathDTO.java +++ b/src/main/java/cz/trailsthroughshadows/api/table/schematic/location/model/dto/LocationPathDTO.java @@ -24,5 +24,6 @@ public class LocationPathDTO implements Serializable { @Id private Integer idEnd; + } diff --git a/src/main/java/cz/trailsthroughshadows/api/table/schematic/location/model/dto/LocationStartDTO.java b/src/main/java/cz/trailsthroughshadows/api/table/schematic/location/model/dto/LocationStartDTO.java index de7aaf1..6ff3da6 100644 --- a/src/main/java/cz/trailsthroughshadows/api/table/schematic/location/model/dto/LocationStartDTO.java +++ b/src/main/java/cz/trailsthroughshadows/api/table/schematic/location/model/dto/LocationStartDTO.java @@ -24,5 +24,6 @@ public class LocationStartDTO implements Serializable { @Id private Integer idHex; + } diff --git a/src/main/java/cz/trailsthroughshadows/api/table/schematic/obstacle/ObstacleRepo.java b/src/main/java/cz/trailsthroughshadows/api/table/schematic/obstacle/ObstacleRepo.java index 0801324..34e3fb3 100644 --- a/src/main/java/cz/trailsthroughshadows/api/table/schematic/obstacle/ObstacleRepo.java +++ b/src/main/java/cz/trailsthroughshadows/api/table/schematic/obstacle/ObstacleRepo.java @@ -3,16 +3,11 @@ import cz.trailsthroughshadows.api.table.schematic.obstacle.model.ObstacleDTO; import org.springframework.data.jpa.repository.EntityGraph; import org.springframework.data.jpa.repository.JpaRepository; -import org.springframework.data.jpa.repository.Query; -import java.util.Collection; import java.util.List; public interface ObstacleRepo extends JpaRepository { - @Query("SELECT c FROM ObstacleDTO c") - Collection getOnlyObstacles(); - @Override @EntityGraph(attributePaths = {"effects"}) List findAll(); diff --git a/src/main/java/cz/trailsthroughshadows/api/table/schematic/part/model/Part.java b/src/main/java/cz/trailsthroughshadows/api/table/schematic/part/model/Part.java index 32eccb3..86e541b 100644 --- a/src/main/java/cz/trailsthroughshadows/api/table/schematic/part/model/Part.java +++ b/src/main/java/cz/trailsthroughshadows/api/table/schematic/part/model/Part.java @@ -43,11 +43,6 @@ public static Part fromDTO(PartDTO dto, LocationDTO location, int rotation, List return part; } - public static PartDTO toDTO(Part part) { - ModelMapper modelMapper = new ModelMapper(); - return modelMapper.map(part, PartDTO.class); - } - public Optional getHex(int id) { return getHexes().stream().filter(h -> h.getKey().getId() == id).findFirst().map(Hex::fromDTO); } diff --git a/src/main/java/cz/trailsthroughshadows/api/table/schematic/path/Path.java b/src/main/java/cz/trailsthroughshadows/api/table/schematic/path/Path.java deleted file mode 100644 index d07a904..0000000 --- a/src/main/java/cz/trailsthroughshadows/api/table/schematic/path/Path.java +++ /dev/null @@ -1,31 +0,0 @@ -package cz.trailsthroughshadows.api.table.schematic.path; - -import jakarta.persistence.Column; -import jakarta.persistence.Embeddable; -import jakarta.persistence.EmbeddedId; -import jakarta.persistence.Table; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Data -@NoArgsConstructor -@AllArgsConstructor -@Table(name = "Path") -public class Path { - - @EmbeddedId - private PathId key; - - @Embeddable - @Data - public static class PathId { - @Column(nullable = false) - private Integer idCampaign; - @Column(nullable = false) - private Integer idStart; - @Column(nullable = false) - private Integer idEnd; - } - -}