Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
Took 6 minutes
  • Loading branch information
Firestone82 committed Feb 3, 2024
1 parent 7c2342c commit 796f932
Show file tree
Hide file tree
Showing 10 changed files with 7 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -16,7 +15,7 @@
@Entity
@NoArgsConstructor
@Table(name = "Enemy")
public class EnemyDTO implements Cloneable {
public class EnemyDTO implements Cloneable {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,4 @@

public interface LocationRepo extends JpaRepository<LocationDTO, Integer> {

@Override
List<LocationDTO> findAll();

@Override
Optional<LocationDTO> findById(Integer id);

}
Original file line number Diff line number Diff line change
Expand Up @@ -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<LocationPartDTO> parts;

@OneToMany(mappedBy = "idLocation", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ public class LocationDoorDTO implements Serializable {

@Id
private int idHex;

}
Original file line number Diff line number Diff line change
Expand Up @@ -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;

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ public class LocationPathDTO implements Serializable {

@Id
private Integer idEnd;

}

Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ public class LocationStartDTO implements Serializable {

@Id
private Integer idHex;

}

Original file line number Diff line number Diff line change
Expand Up @@ -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<ObstacleDTO, Integer> {

@Query("SELECT c FROM ObstacleDTO c")
Collection<ObstacleDTO> getOnlyObstacles();

@Override
@EntityGraph(attributePaths = {"effects"})
List<ObstacleDTO> findAll();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Hex> getHex(int id) {
return getHexes().stream().filter(h -> h.getKey().getId() == id).findFirst().map(Hex::fromDTO);
}
Expand Down

This file was deleted.

0 comments on commit 796f932

Please sign in to comment.