1
0

10 کامیت‌ها 8018360c44 ... 8bedd6a1c6

نویسنده SHA1 پیام تاریخ
  DricomDragon 8bedd6a1c6 :memo: Etude des routes possibles 1 ماه پیش
  DricomDragon a201580e9e :wrench: Premiere route post 1 ماه پیش
  DricomDragon 9a6c55b7ed :fire: Remove every mention of mech in the back 2 ماه پیش
  DricomDragon a8dc56967c :tada: Add an endpoint to see squads of a player 2 ماه پیش
  DricomDragon 888a04dcb7 :beetle: Fix infinite recursion in details Rest API 2 ماه پیش
  DricomDragon 4ac1c38bcc :memo: Add game squads and an anonymous user 2 ماه پیش
  DricomDragon d1283fb004 :beetle: Fix infinite recursion in Rest API 2 ماه پیش
  DricomDragon 5a16da0351 :tada: Add squads endpoint 2 ماه پیش
  DricomDragon 35a0d6d0fe :tada: Import spring data and jpa to create /players endpoint 2 ماه پیش
  DricomDragon 0f45a80b3c :fire: Remove mech table 2 ماه پیش
25فایلهای تغییر یافته به همراه544 افزوده شده و 198 حذف شده
  1. 49 0
      README.md
  2. 4 0
      dev-back/pom.xml
  3. 0 41
      dev-back/src/main/java/eu/jovian_hersemeule/dev/squad/squad_composer/controllers/MechController.java
  4. 46 0
      dev-back/src/main/java/eu/jovian_hersemeule/dev/squad/squad_composer/controllers/PlayerController.java
  5. 54 0
      dev-back/src/main/java/eu/jovian_hersemeule/dev/squad/squad_composer/controllers/SquadController.java
  6. 0 5
      dev-back/src/main/java/eu/jovian_hersemeule/dev/squad/squad_composer/data/DataService.java
  7. 0 24
      dev-back/src/main/java/eu/jovian_hersemeule/dev/squad/squad_composer/data/MechRowMapper.java
  8. 18 0
      dev-back/src/main/java/eu/jovian_hersemeule/dev/squad/squad_composer/data/input/NewSquad.java
  9. 38 0
      dev-back/src/main/java/eu/jovian_hersemeule/dev/squad/squad_composer/data/jpa/PlayerEntity.java
  10. 89 0
      dev-back/src/main/java/eu/jovian_hersemeule/dev/squad/squad_composer/data/jpa/SquadEntity.java
  11. 0 5
      dev-back/src/main/java/eu/jovian_hersemeule/dev/squad/squad_composer/data/model/Mech.java
  12. 29 0
      dev-back/src/main/java/eu/jovian_hersemeule/dev/squad/squad_composer/data/projections/PlayerItem.java
  13. 71 0
      dev-back/src/main/java/eu/jovian_hersemeule/dev/squad/squad_composer/data/projections/SquadDetails.java
  14. 64 0
      dev-back/src/main/java/eu/jovian_hersemeule/dev/squad/squad_composer/data/projections/SquadItem.java
  15. 10 0
      dev-back/src/main/java/eu/jovian_hersemeule/dev/squad/squad_composer/data/repos/PlayerRepository.java
  16. 10 0
      dev-back/src/main/java/eu/jovian_hersemeule/dev/squad/squad_composer/data/repos/SquadRepository.java
  17. 0 23
      dev-back/src/main/resources/db/migration/V1_0_1__Create_squad_mech_tables.sql
  18. 11 0
      dev-back/src/main/resources/db/migration/V1_0_1__Create_squad_table.sql
  19. 20 0
      dev-back/src/main/resources/db/migration/V1_0_2__Insert_game_squads.sql
  20. 2 0
      dev-back/src/main/resources/db/migration/V1_0_3__Insert_anonymous_player.sql
  21. 0 43
      dev-back/src/main/resources/db/migration/V1_1_0__Insert_mech_data.sql
  22. 1 1
      dev-back/src/main/resources/logback.xml
  23. BIN
      doc/entity-relation-diagram-v2.png
  24. 20 55
      doc/entity-relation-diagram.drawio
  25. 8 1
      tools/api/SquadComposer-soapui-project.xml

+ 49 - 0
README.md

@@ -1,3 +1,52 @@
 # Squad Composer
 
 SpringBoot project to make squads.
+
+## Back
+
+### Endpoints
+
+#### Full CRUD version
+
++ Benefits
+    + Simple
+    + Everything doable via REST
+- Bad
+    - Mix player and squad in a route
+    - Many routes
+    - Should be modified a lot to take JWT into account
+
+GET `/players` : list all players.
+
+PUT `/players` : create a player.
+
+DELETE 
+
+GET `/players/{p_id}` : get a specific player
+
+GET `/players/{p_id}/squads` : get squads of this player.
+
+POST `/players/{p_id}/squads` : create a new squad ; return created s_id.
+
+PUT `/players/{p_id}/squads/{s_id}` : update a squad.
+
+GET `/players/{p_id}/squads/{s_id}` : get a specific squad.
+
+GET `/squads` : get all squads.
+
+#### Separated version
+
+GET `/players` : list all players.
+
+GET `/players/{p_id}` : get a specific player
+
+GET `/players/{p_id}/squads` : get squads of this player.
+
+
+GET `/squads` : get all squads.
+
+GET `/squads/{s_id}` : get a specific squad.
+
+POST `/squads` : create a new squad attached to the connected player; return created s_id.
+
+PUT `/squads/{s_id}` : update a squad.

+ 4 - 0
dev-back/pom.xml

@@ -39,6 +39,10 @@
             <artifactId>spring-jdbc</artifactId>
         </dependency>
         <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-data-jpa</artifactId>
+        </dependency>
+        <dependency>
             <groupId>com.zaxxer</groupId>
             <artifactId>HikariCP</artifactId>
         </dependency>

+ 0 - 41
dev-back/src/main/java/eu/jovian_hersemeule/dev/squad/squad_composer/controllers/MechController.java

@@ -1,41 +0,0 @@
-package eu.jovian_hersemeule.dev.squad.squad_composer.controllers;
-
-import org.springframework.web.bind.annotation.RestController;
-import eu.jovian_hersemeule.dev.squad.squad_composer.data.MechRowMapper;
-import eu.jovian_hersemeule.dev.squad.squad_composer.data.model.Mech;
-import java.util.List;
-
-import javax.sql.DataSource;
-
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.jdbc.core.JdbcTemplate;
-
-@RestController
-@RequestMapping("/mech")
-public class MechController {
-
-    private final JdbcTemplate jdbcTemplate;
-
-    private final MechRowMapper mapper = new MechRowMapper();
-
-    MechController(final DataSource ds) {
-        jdbcTemplate = new JdbcTemplate(ds);
-    }
-
-    @GetMapping("/")
-    public List<Mech> list() {
-        return jdbcTemplate.query("SELECT * FROM MECH", mapper);
-    }
-
-    @GetMapping("/{id}")
-    public Mech get(@PathVariable final int id) {
-        final List<Mech> ans = jdbcTemplate.query("SELECT * FROM mech WHERE id = ?", mapper, id);
-        if (ans.isEmpty()) {
-            return null;
-        }
-        return ans.get(0);
-    }
-    
-}

+ 46 - 0
dev-back/src/main/java/eu/jovian_hersemeule/dev/squad/squad_composer/controllers/PlayerController.java

@@ -0,0 +1,46 @@
+package eu.jovian_hersemeule.dev.squad.squad_composer.controllers;
+
+import org.springframework.web.bind.annotation.RestController;
+import eu.jovian_hersemeule.dev.squad.squad_composer.data.projections.PlayerItem;
+import eu.jovian_hersemeule.dev.squad.squad_composer.data.projections.SquadItem;
+import eu.jovian_hersemeule.dev.squad.squad_composer.data.repos.PlayerRepository;
+
+import java.util.List;
+
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+@RestController
+@RequestMapping("/players")
+public class PlayerController {
+
+    final private PlayerRepository repo;
+
+    PlayerController(final PlayerRepository playerRepository) {
+        this.repo = playerRepository;
+    }
+
+    @GetMapping("/")
+    public List<PlayerItem> listPlayers() {
+        return repo.findAll().stream()
+                .map(PlayerItem::project)
+                .toList();
+    }
+
+    @GetMapping("/{id}")
+    public PlayerItem getASpecificPlayer(@PathVariable final long id) {
+        return repo.findById(id)
+                .map(PlayerItem::project)
+                .orElseThrow(() -> new RuntimeException("Player not found"));
+    }
+
+    @GetMapping("/{id}/squads")
+    public List<SquadItem> getSquadsOfPlayer(@PathVariable final long id) {
+        return repo.findById(id).stream()
+                .flatMap(player -> player.getSquads().stream())
+                .map(SquadItem::project)
+                .toList();
+    }
+    
+}

+ 54 - 0
dev-back/src/main/java/eu/jovian_hersemeule/dev/squad/squad_composer/controllers/SquadController.java

@@ -0,0 +1,54 @@
+package eu.jovian_hersemeule.dev.squad.squad_composer.controllers;
+
+import org.springframework.web.bind.annotation.RestController;
+
+import eu.jovian_hersemeule.dev.squad.squad_composer.data.input.NewSquad;
+import eu.jovian_hersemeule.dev.squad.squad_composer.data.jpa.SquadEntity;
+import eu.jovian_hersemeule.dev.squad.squad_composer.data.projections.SquadDetails;
+import eu.jovian_hersemeule.dev.squad.squad_composer.data.projections.SquadItem;
+import eu.jovian_hersemeule.dev.squad.squad_composer.data.repos.SquadRepository;
+
+import java.util.List;
+import java.util.logging.Logger;
+
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+@RestController
+@RequestMapping("/squads")
+public class SquadController {
+
+    final private Logger logger = Logger.getLogger(SquadController.class.getName());
+
+    final private SquadRepository repo;
+
+    SquadController(final SquadRepository squadRepository) {
+        this.repo = squadRepository;
+    }
+
+    @GetMapping("/")
+    public List<SquadItem> list() {
+        logger.fine("Listing squads");
+        return repo.findAll().stream()
+                .map(SquadItem::project)
+                .toList();
+    }
+
+    @GetMapping("/{id}")
+    public SquadDetails get(@PathVariable final long id) {
+        logger.fine("Getting squad " + id);
+        return repo.findById(id)
+                .map(SquadDetails::project)
+                .orElseThrow(() -> new RuntimeException("Squad not found"));
+    }
+
+    @PostMapping("/")
+    public SquadDetails create(final NewSquad newSquad) {
+        logger.info("Creating squad " + newSquad);
+        final SquadEntity newEntity = repo.save(newSquad.buildEntity());
+        return SquadDetails.project(newEntity);
+    }
+
+}

+ 0 - 5
dev-back/src/main/java/eu/jovian_hersemeule/dev/squad/squad_composer/data/DataService.java

@@ -1,5 +0,0 @@
-package eu.jovian_hersemeule.dev.squad.squad_composer.data;
-
-public class DataService {
-    
-}

+ 0 - 24
dev-back/src/main/java/eu/jovian_hersemeule/dev/squad/squad_composer/data/MechRowMapper.java

@@ -1,24 +0,0 @@
-package eu.jovian_hersemeule.dev.squad.squad_composer.data;
-
-import java.sql.ResultSet;
-import java.sql.SQLException;
-
-import org.springframework.jdbc.core.RowMapper;
-import org.springframework.lang.NonNull;
-import org.springframework.lang.Nullable;
-
-import eu.jovian_hersemeule.dev.squad.squad_composer.data.model.Mech;
-
-public class MechRowMapper implements RowMapper<Mech> {
-
-    @Override
-    @Nullable
-    public Mech mapRow(final @NonNull ResultSet rs, int rowNum) throws SQLException {
-        return new Mech(
-            rs.getInt("id"),
-            rs.getString("name"),
-            rs.getString("class"),
-            rs.getInt("resistance"));
-    }
-
-}

+ 18 - 0
dev-back/src/main/java/eu/jovian_hersemeule/dev/squad/squad_composer/data/input/NewSquad.java

@@ -0,0 +1,18 @@
+package eu.jovian_hersemeule.dev.squad.squad_composer.data.input;
+
+import eu.jovian_hersemeule.dev.squad.squad_composer.data.jpa.SquadEntity;
+
+public record NewSquad(String name, String comment, Integer mech1Id, Integer mech2Id, Integer mech3Id) {
+
+    public SquadEntity buildEntity() {
+        var newEntity = new SquadEntity();
+
+        newEntity.setName(name);
+        newEntity.setComment(comment);
+        newEntity.setMech1Id(mech1Id);
+        newEntity.setMech2Id(mech2Id);
+        newEntity.setMech3Id(mech3Id);
+
+        return newEntity;
+    }
+};

+ 38 - 0
dev-back/src/main/java/eu/jovian_hersemeule/dev/squad/squad_composer/data/jpa/PlayerEntity.java

@@ -0,0 +1,38 @@
+package eu.jovian_hersemeule.dev.squad.squad_composer.data.jpa;
+
+import java.util.List;
+
+import jakarta.persistence.*;
+
+@Entity
+@Table(name = "player")
+public class PlayerEntity {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "id")
+    private Long id;
+
+    @Column(name = "name", nullable = false, length = 50)
+    private String name;
+
+    @OneToMany(mappedBy = "player")
+    private List<SquadEntity> squads;
+
+    public Long getId() {
+        return id;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public List<SquadEntity> getSquads() {
+        return squads;
+    }
+
+}

+ 89 - 0
dev-back/src/main/java/eu/jovian_hersemeule/dev/squad/squad_composer/data/jpa/SquadEntity.java

@@ -0,0 +1,89 @@
+package eu.jovian_hersemeule.dev.squad.squad_composer.data.jpa;
+
+import jakarta.persistence.*;
+import java.sql.Timestamp;
+
+@Entity
+@Table(name = "squad")
+public class SquadEntity {
+
+    @Id
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
+    @Column(name = "id")
+    private Long id;
+
+    @ManyToOne
+    @JoinColumn(name = "player_id", insertable = false, updatable = false)
+    private PlayerEntity player;
+
+    @Column(name = "creation_date")
+    private Timestamp creationDate;
+
+    @Column(name = "name", nullable = false, length = 50)
+    private String name;
+
+    @Column(name = "comment")
+    private String comment;
+
+    @Column(name = "mech_1_id")
+    private Integer mech1Id;
+
+    @Column(name = "mech_2_id")
+    private Integer mech2Id;
+
+    @Column(name = "mech_3_id")
+    private Integer mech3Id;
+
+    public Long getId() {
+        return id;
+    }
+
+    public PlayerEntity getPlayer() {
+        return player;
+    }
+
+    public Timestamp getCreationDate() {
+        return creationDate;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getComment() {
+        return comment;
+    }
+
+    public void setComment(String comment) {
+        this.comment = comment;
+    }
+
+    public Integer getMech1Id() {
+        return mech1Id;
+    }
+
+    public void setMech1Id(Integer mech1Id) {
+        this.mech1Id = mech1Id;
+    }
+
+    public Integer getMech2Id() {
+        return mech2Id;
+    }
+
+    public void setMech2Id(Integer mech2Id) {
+        this.mech2Id = mech2Id;
+    }
+
+    public Integer getMech3Id() {
+        return mech3Id;
+    }
+
+    public void setMech3Id(Integer mech3Id) {
+        this.mech3Id = mech3Id;
+    }
+
+}

+ 0 - 5
dev-back/src/main/java/eu/jovian_hersemeule/dev/squad/squad_composer/data/model/Mech.java

@@ -1,5 +0,0 @@
-package eu.jovian_hersemeule.dev.squad.squad_composer.data.model;
-
-public record Mech(int id, String name, String kind, Integer health) {
-    // Nothing
-}

+ 29 - 0
dev-back/src/main/java/eu/jovian_hersemeule/dev/squad/squad_composer/data/projections/PlayerItem.java

@@ -0,0 +1,29 @@
+package eu.jovian_hersemeule.dev.squad.squad_composer.data.projections;
+
+import eu.jovian_hersemeule.dev.squad.squad_composer.data.jpa.PlayerEntity;
+
+/**
+ * Projection qui ne retourne pas beaucoup d'infos.
+ */
+public class PlayerItem {
+
+    private final long id;
+    private final String name;
+
+    public static PlayerItem project(final PlayerEntity entity) {
+        return new PlayerItem(entity);
+    }
+
+    private PlayerItem(final PlayerEntity entity) {
+        this.id = entity.getId();
+        this.name = entity.getName();
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public String getName() {
+        return name;
+    }
+}

+ 71 - 0
dev-back/src/main/java/eu/jovian_hersemeule/dev/squad/squad_composer/data/projections/SquadDetails.java

@@ -0,0 +1,71 @@
+package eu.jovian_hersemeule.dev.squad.squad_composer.data.projections;
+
+import java.time.Instant;
+
+import eu.jovian_hersemeule.dev.squad.squad_composer.data.jpa.SquadEntity;
+
+public class SquadDetails {
+
+    private Long id;
+
+    private PlayerItem player;
+
+    private Instant creationDate;
+
+    private String name;
+
+    private String comment;
+
+    private Integer mech1Id;
+
+    private Integer mech2Id;
+
+    private Integer mech3Id;
+
+    public static SquadDetails project(final SquadEntity entity) {
+        return new SquadDetails(entity);
+    }
+
+    private SquadDetails(final SquadEntity squadEntity) {
+        this.id = squadEntity.getId();
+        this.name = squadEntity.getName();
+        this.comment = squadEntity.getComment();
+        this.player = PlayerItem.project(squadEntity.getPlayer());
+        this.creationDate = squadEntity.getCreationDate().toInstant();
+        this.mech1Id = squadEntity.getMech1Id();
+        this.mech2Id = squadEntity.getMech2Id();
+        this.mech3Id = squadEntity.getMech3Id();
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public PlayerItem getPlayer() {
+        return player;
+    }
+
+    public Instant getCreationDate() {
+        return creationDate;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public String getComment() {
+        return comment;
+    }
+
+    public Integer getMech1Id() {
+        return mech1Id;
+    }
+
+    public Integer getMech2Id() {
+        return mech2Id;
+    }
+
+    public Integer getMech3Id() {
+        return mech3Id;
+    }
+}

+ 64 - 0
dev-back/src/main/java/eu/jovian_hersemeule/dev/squad/squad_composer/data/projections/SquadItem.java

@@ -0,0 +1,64 @@
+package eu.jovian_hersemeule.dev.squad.squad_composer.data.projections;
+
+import java.time.Instant;
+
+import eu.jovian_hersemeule.dev.squad.squad_composer.data.jpa.SquadEntity;
+
+public class SquadItem {
+
+    private Long id;
+
+    private Long playerId;
+
+    private Instant creationDate;
+
+    private String name;
+
+    private Integer mech1Id;
+
+    private Integer mech2Id;
+
+    private Integer mech3Id;
+
+    public static SquadItem project(final SquadEntity entity) {
+        return new SquadItem(entity);
+    }
+
+    private SquadItem(final SquadEntity entity) {
+        this.id = entity.getId();
+        this.name = entity.getName();
+        this.playerId = entity.getPlayer().getId();
+        this.creationDate = entity.getCreationDate().toInstant();
+        this.mech1Id = entity.getMech1Id();
+        this.mech2Id = entity.getMech2Id();
+        this.mech3Id = entity.getMech3Id();
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public Long getPlayerId() {
+        return playerId;
+    }
+
+    public Instant getCreationDate() {
+        return creationDate;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public Integer getMech1Id() {
+        return mech1Id;
+    }
+
+    public Integer getMech2Id() {
+        return mech2Id;
+    }
+
+    public Integer getMech3Id() {
+        return mech3Id;
+    }
+}

+ 10 - 0
dev-back/src/main/java/eu/jovian_hersemeule/dev/squad/squad_composer/data/repos/PlayerRepository.java

@@ -0,0 +1,10 @@
+package eu.jovian_hersemeule.dev.squad.squad_composer.data.repos;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+import eu.jovian_hersemeule.dev.squad.squad_composer.data.jpa.PlayerEntity;
+
+@Repository
+public interface PlayerRepository extends JpaRepository<PlayerEntity, Long> {
+}

+ 10 - 0
dev-back/src/main/java/eu/jovian_hersemeule/dev/squad/squad_composer/data/repos/SquadRepository.java

@@ -0,0 +1,10 @@
+package eu.jovian_hersemeule.dev.squad.squad_composer.data.repos;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.stereotype.Repository;
+
+import eu.jovian_hersemeule.dev.squad.squad_composer.data.jpa.SquadEntity;
+
+@Repository
+public interface SquadRepository extends JpaRepository<SquadEntity, Long> {
+}

+ 0 - 23
dev-back/src/main/resources/db/migration/V1_0_1__Create_squad_mech_tables.sql

@@ -1,23 +0,0 @@
-CREATE TABLE squad (
-  id SERIAL PRIMARY KEY,
-  player_id INTEGER NOT NULL,
-  creation_date TIMESTAMP NOT NULL,
-  name VARCHAR(50) NOT NULL,
-  comment TEXT,
-  FOREIGN KEY (player_id) REFERENCES player(id)
-);
-
-CREATE TABLE mech (
-  id SERIAL PRIMARY KEY,
-  name VARCHAR(50) NOT NULL,
-  class VARCHAR(10) NOT NULL,
-  resistance INTEGER NOT NULL DEFAULT 3
-);
-
-CREATE TABLE squad_mech (
-  squad_id INTEGER NOT NULL,
-  mech_id INTEGER NOT NULL,
-  PRIMARY KEY (squad_id, mech_id),
-  FOREIGN KEY (squad_id) REFERENCES squad(id),
-  FOREIGN KEY (mech_id) REFERENCES mech(id)
-);

+ 11 - 0
dev-back/src/main/resources/db/migration/V1_0_1__Create_squad_table.sql

@@ -0,0 +1,11 @@
+CREATE TABLE squad (
+  id SERIAL PRIMARY KEY,
+  player_id INTEGER NOT NULL,
+  creation_date TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
+  name VARCHAR(50) NOT NULL,
+  comment TEXT,
+  FOREIGN KEY (player_id) REFERENCES player(id),
+  mech_1_id INTEGER,
+  mech_2_id INTEGER,
+  mech_3_id INTEGER
+);

+ 20 - 0
dev-back/src/main/resources/db/migration/V1_0_2__Insert_game_squads.sql

@@ -0,0 +1,20 @@
+INSERT INTO dev.player(name)
+	VALUES ('Into The Breach');
+
+INSERT INTO dev.squad(player_id, name, comment, mech_1_id, mech_2_id, mech_3_id)
+	VALUES 
+    (1, 'Rift Walkers', 'Game squad provided by the developers.', 1, 2, 3),
+    (1, 'Steel Judoka', 'Game squad provided by the developers.', 4, 5, 6),
+    (1, 'Rusting Hulks', 'Game squad provided by the developers.', 7, 8, 9),
+    (1, 'Flame Behemoths', 'Game squad provided by the developers.', 10, 11, 12),
+    (1, 'Zenith Guard', 'Game squad provided by the developers.', 13, 14, 15),
+    (1, 'Frozen Titans', 'Game squad provided by the developers.', 16, 17, 18),
+    (1, 'Blitzkrieg', 'Game squad provided by the developers.', 19, 20, 21),
+    (1, 'Hazardous  Mechs', 'Game squad provided by the developers.', 22, 23, 24),
+    (1, 'Secret Squad', 'Game squad provided by the developers.', 25, 26, 27),
+    (1, 'Bombermechs', 'Game squad provided by the developers.', 28, 29, 30),
+    (1, 'Arachnophiles', 'Game squad provided by the developers.', 31, 32, 33),
+    (1, 'Mist Eaters', 'Game squad provided by the developers.', 34, 35, 36),
+    (1, 'Heat Sinkers', 'Game squad provided by the developers.', 37, 38, 39),
+    (1, 'Cataclysm', 'Game squad provided by the developers.', 40, 41, 42)
+    ;

+ 2 - 0
dev-back/src/main/resources/db/migration/V1_0_3__Insert_anonymous_player.sql

@@ -0,0 +1,2 @@
+INSERT INTO dev.player(name)
+	VALUES ('anonymous');

+ 0 - 43
dev-back/src/main/resources/db/migration/V1_1_0__Insert_mech_data.sql

@@ -1,43 +0,0 @@
-INSERT INTO mech (name, class, resistance)
-VALUES
-('Combat','Prime',3),
-('Cannon','Brute',3),
-('Artillery','Ranged',2),
-('Judo','Prime',3),
-('Siege','Ranged',2),
-('Gravity','Science',3),
-('Jet','Brute',2),
-('Rocket','Ranged',3),
-('Pulse','Science',3),
-('Flame','Prime',3),
-('Meteor','Ranged',3),
-('Swap','Science',2),
-('Laser','Prime',3),
-('Charge','Brute',3),
-('Defense','Science',2),
-('Aegis','Prime',3),
-('Mirror','Brute',3),
-('Ice','Ranged',2),
-('Lightning','Prime',3),
-('Hook','Brute',3),
-('Boulder','Ranged',2),
-('Leap','Prime',3),
-('Unstable','Brute',3),
-('Nano','Science',2),
-('Beetle','Cyborg',3),
-('Hornet','Cyborg',2),
-('Scarab','Cyborg',2),
-('Pierce','Brute',3),
-('Bombling','Ranged',3),
-('Exchange','Science',2),
-('Bulk','Brute',3),
-('Arachnoid','Ranged',3),
-('Slide','Science',2),
-('Thruster','Brute',3),
-('Smog','Ranged',3),
-('Control','Science',2),
-('Dispersal','Prime',3),
-('Napalm','Brute',2),
-('Pitcher','Prime',4),
-('Triptych','Ranged',2),
-('Drill','Science',3);

+ 1 - 1
dev-back/src/main/resources/logback.xml

@@ -2,7 +2,7 @@
 <configuration>
     <include resource="org/springframework/boot/logging/logback/base.xml"/>
 
-    <logger name="org.flywaydb" level="DEBUG"/>
+    <logger name="eu.jovian_hersemeule.dev" level="DEBUG"/>
 
     <root level="INFO">
         <appender-ref ref="CONSOLE"/>

BIN
doc/entity-relation-diagram-v2.png


+ 20 - 55
doc/entity-relation-diagram.drawio

@@ -1,4 +1,4 @@
-<mxfile host="Electron" modified="2024-08-11T08:11:24.031Z" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/24.6.4 Chrome/124.0.6367.207 Electron/30.0.6 Safari/537.36" etag="f3Lce4ihHKwavLah3tvR" version="24.6.4" type="device">
+<mxfile host="Electron" modified="2024-09-09T15:39:37.735Z" agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/24.6.4 Chrome/124.0.6367.207 Electron/30.0.6 Safari/537.36" etag="9gHxe6F6dL04HJqYRCir" version="24.6.4" type="device">
   <diagram id="R2lEEEUBdFMjLlhIrx00" name="Page-1">
     <mxGraphModel dx="1434" dy="883" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0" extFonts="Permanent Marker^https://fonts.googleapis.com/css?family=Permanent+Marker">
       <root>
@@ -10,14 +10,8 @@
             <mxPoint x="440" y="620" as="targetPoint" />
           </mxGeometry>
         </mxCell>
-        <mxCell id="C-vyLk0tnHw3VtMMgP7b-12" value="" style="edgeStyle=entityRelationEdgeStyle;endArrow=ERzeroToMany;startArrow=ERone;endFill=1;startFill=0;" parent="1" source="C-vyLk0tnHw3VtMMgP7b-3" target="C-vyLk0tnHw3VtMMgP7b-17" edge="1">
-          <mxGeometry width="100" height="100" relative="1" as="geometry">
-            <mxPoint x="400" y="180" as="sourcePoint" />
-            <mxPoint x="460" y="205" as="targetPoint" />
-          </mxGeometry>
-        </mxCell>
         <mxCell id="C-vyLk0tnHw3VtMMgP7b-2" value="Squad" style="shape=table;startSize=30;container=1;collapsible=1;childLayout=tableLayout;fixedRows=1;rowLines=0;fontStyle=1;align=center;resizeLast=1;" parent="1" vertex="1">
-          <mxGeometry x="450" y="120" width="250" height="190" as="geometry" />
+          <mxGeometry x="450" y="120" width="250" height="280" as="geometry" />
         </mxCell>
         <mxCell id="C-vyLk0tnHw3VtMMgP7b-3" value="" style="shape=partialRectangle;collapsible=0;dropTarget=0;pointerEvents=0;fillColor=none;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=1;" parent="C-vyLk0tnHw3VtMMgP7b-2" vertex="1">
           <mxGeometry y="30" width="250" height="30" as="geometry" />
@@ -58,96 +52,67 @@
             <mxRectangle width="220" height="30" as="alternateBounds" />
           </mxGeometry>
         </mxCell>
-        <mxCell id="vGfOE6fh8Fkg2EA02DIV-7" value="" style="shape=partialRectangle;collapsible=0;dropTarget=0;pointerEvents=0;fillColor=none;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=0;" vertex="1" parent="C-vyLk0tnHw3VtMMgP7b-2">
+        <mxCell id="vGfOE6fh8Fkg2EA02DIV-7" value="" style="shape=partialRectangle;collapsible=0;dropTarget=0;pointerEvents=0;fillColor=none;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=0;" parent="C-vyLk0tnHw3VtMMgP7b-2" vertex="1">
           <mxGeometry y="120" width="250" height="30" as="geometry" />
         </mxCell>
-        <mxCell id="vGfOE6fh8Fkg2EA02DIV-8" value="" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;" vertex="1" parent="vGfOE6fh8Fkg2EA02DIV-7">
+        <mxCell id="vGfOE6fh8Fkg2EA02DIV-8" value="" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;" parent="vGfOE6fh8Fkg2EA02DIV-7" vertex="1">
           <mxGeometry width="30" height="30" as="geometry">
             <mxRectangle width="30" height="30" as="alternateBounds" />
           </mxGeometry>
         </mxCell>
-        <mxCell id="vGfOE6fh8Fkg2EA02DIV-9" value="name varchar NOT NULL" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;" vertex="1" parent="vGfOE6fh8Fkg2EA02DIV-7">
+        <mxCell id="vGfOE6fh8Fkg2EA02DIV-9" value="name varchar NOT NULL" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;" parent="vGfOE6fh8Fkg2EA02DIV-7" vertex="1">
           <mxGeometry x="30" width="220" height="30" as="geometry">
             <mxRectangle width="220" height="30" as="alternateBounds" />
           </mxGeometry>
         </mxCell>
-        <mxCell id="vGfOE6fh8Fkg2EA02DIV-10" value="" style="shape=partialRectangle;collapsible=0;dropTarget=0;pointerEvents=0;fillColor=none;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=0;" vertex="1" parent="C-vyLk0tnHw3VtMMgP7b-2">
+        <mxCell id="vGfOE6fh8Fkg2EA02DIV-10" value="" style="shape=partialRectangle;collapsible=0;dropTarget=0;pointerEvents=0;fillColor=none;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=0;" parent="C-vyLk0tnHw3VtMMgP7b-2" vertex="1">
           <mxGeometry y="150" width="250" height="30" as="geometry" />
         </mxCell>
-        <mxCell id="vGfOE6fh8Fkg2EA02DIV-11" value="" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;" vertex="1" parent="vGfOE6fh8Fkg2EA02DIV-10">
+        <mxCell id="vGfOE6fh8Fkg2EA02DIV-11" value="" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;" parent="vGfOE6fh8Fkg2EA02DIV-10" vertex="1">
           <mxGeometry width="30" height="30" as="geometry">
             <mxRectangle width="30" height="30" as="alternateBounds" />
           </mxGeometry>
         </mxCell>
-        <mxCell id="vGfOE6fh8Fkg2EA02DIV-12" value="comment text" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;" vertex="1" parent="vGfOE6fh8Fkg2EA02DIV-10">
+        <mxCell id="vGfOE6fh8Fkg2EA02DIV-12" value="comment text" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;" parent="vGfOE6fh8Fkg2EA02DIV-10" vertex="1">
           <mxGeometry x="30" width="220" height="30" as="geometry">
             <mxRectangle width="220" height="30" as="alternateBounds" />
           </mxGeometry>
         </mxCell>
-        <mxCell id="C-vyLk0tnHw3VtMMgP7b-13" value="Mech" style="shape=table;startSize=30;container=1;collapsible=1;childLayout=tableLayout;fixedRows=1;rowLines=0;fontStyle=1;align=center;resizeLast=1;" parent="1" vertex="1">
-          <mxGeometry x="450" y="320" width="250" height="190" as="geometry" />
+        <mxCell id="Tb8xqYRGo6f0FsYqac5e-1" value="" style="shape=partialRectangle;collapsible=0;dropTarget=0;pointerEvents=0;fillColor=none;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=0;" vertex="1" parent="C-vyLk0tnHw3VtMMgP7b-2">
+          <mxGeometry y="180" width="250" height="30" as="geometry" />
         </mxCell>
-        <mxCell id="C-vyLk0tnHw3VtMMgP7b-14" value="" style="shape=partialRectangle;collapsible=0;dropTarget=0;pointerEvents=0;fillColor=none;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=1;" parent="C-vyLk0tnHw3VtMMgP7b-13" vertex="1">
-          <mxGeometry y="30" width="250" height="30" as="geometry" />
-        </mxCell>
-        <mxCell id="C-vyLk0tnHw3VtMMgP7b-15" value="PK" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;fontStyle=1;" parent="C-vyLk0tnHw3VtMMgP7b-14" vertex="1">
+        <mxCell id="Tb8xqYRGo6f0FsYqac5e-2" value="" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;" vertex="1" parent="Tb8xqYRGo6f0FsYqac5e-1">
           <mxGeometry width="30" height="30" as="geometry">
             <mxRectangle width="30" height="30" as="alternateBounds" />
           </mxGeometry>
         </mxCell>
-        <mxCell id="C-vyLk0tnHw3VtMMgP7b-16" value="id int NOT NULL " style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;fontStyle=5;" parent="C-vyLk0tnHw3VtMMgP7b-14" vertex="1">
+        <mxCell id="Tb8xqYRGo6f0FsYqac5e-3" value="mech_1_id" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;" vertex="1" parent="Tb8xqYRGo6f0FsYqac5e-1">
           <mxGeometry x="30" width="220" height="30" as="geometry">
             <mxRectangle width="220" height="30" as="alternateBounds" />
           </mxGeometry>
         </mxCell>
-        <mxCell id="C-vyLk0tnHw3VtMMgP7b-17" value="" style="shape=partialRectangle;collapsible=0;dropTarget=0;pointerEvents=0;fillColor=none;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=0;" parent="C-vyLk0tnHw3VtMMgP7b-13" vertex="1">
-          <mxGeometry y="60" width="250" height="30" as="geometry" />
+        <mxCell id="Tb8xqYRGo6f0FsYqac5e-7" value="" style="shape=partialRectangle;collapsible=0;dropTarget=0;pointerEvents=0;fillColor=none;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=0;" vertex="1" parent="C-vyLk0tnHw3VtMMgP7b-2">
+          <mxGeometry y="210" width="250" height="30" as="geometry" />
         </mxCell>
-        <mxCell id="C-vyLk0tnHw3VtMMgP7b-18" value="FK1" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;" parent="C-vyLk0tnHw3VtMMgP7b-17" vertex="1">
+        <mxCell id="Tb8xqYRGo6f0FsYqac5e-8" value="" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;" vertex="1" parent="Tb8xqYRGo6f0FsYqac5e-7">
           <mxGeometry width="30" height="30" as="geometry">
             <mxRectangle width="30" height="30" as="alternateBounds" />
           </mxGeometry>
         </mxCell>
-        <mxCell id="C-vyLk0tnHw3VtMMgP7b-19" value="squad_id int NOT NULL" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;" parent="C-vyLk0tnHw3VtMMgP7b-17" vertex="1">
+        <mxCell id="Tb8xqYRGo6f0FsYqac5e-9" value="mech_2_id" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;" vertex="1" parent="Tb8xqYRGo6f0FsYqac5e-7">
           <mxGeometry x="30" width="220" height="30" as="geometry">
             <mxRectangle width="220" height="30" as="alternateBounds" />
           </mxGeometry>
         </mxCell>
-        <mxCell id="C-vyLk0tnHw3VtMMgP7b-20" value="" style="shape=partialRectangle;collapsible=0;dropTarget=0;pointerEvents=0;fillColor=none;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=0;" parent="C-vyLk0tnHw3VtMMgP7b-13" vertex="1">
-          <mxGeometry y="90" width="250" height="30" as="geometry" />
-        </mxCell>
-        <mxCell id="C-vyLk0tnHw3VtMMgP7b-21" value="" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;" parent="C-vyLk0tnHw3VtMMgP7b-20" vertex="1">
-          <mxGeometry width="30" height="30" as="geometry">
-            <mxRectangle width="30" height="30" as="alternateBounds" />
-          </mxGeometry>
-        </mxCell>
-        <mxCell id="C-vyLk0tnHw3VtMMgP7b-22" value="name varchar NOT NULL" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;" parent="C-vyLk0tnHw3VtMMgP7b-20" vertex="1">
-          <mxGeometry x="30" width="220" height="30" as="geometry">
-            <mxRectangle width="220" height="30" as="alternateBounds" />
-          </mxGeometry>
-        </mxCell>
-        <mxCell id="vGfOE6fh8Fkg2EA02DIV-1" value="" style="shape=partialRectangle;collapsible=0;dropTarget=0;pointerEvents=0;fillColor=none;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=0;" vertex="1" parent="C-vyLk0tnHw3VtMMgP7b-13">
-          <mxGeometry y="120" width="250" height="30" as="geometry" />
-        </mxCell>
-        <mxCell id="vGfOE6fh8Fkg2EA02DIV-2" value="" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;" vertex="1" parent="vGfOE6fh8Fkg2EA02DIV-1">
-          <mxGeometry width="30" height="30" as="geometry">
-            <mxRectangle width="30" height="30" as="alternateBounds" />
-          </mxGeometry>
-        </mxCell>
-        <mxCell id="vGfOE6fh8Fkg2EA02DIV-3" value="class varchar NOT NULL" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;" vertex="1" parent="vGfOE6fh8Fkg2EA02DIV-1">
-          <mxGeometry x="30" width="220" height="30" as="geometry">
-            <mxRectangle width="220" height="30" as="alternateBounds" />
-          </mxGeometry>
-        </mxCell>
-        <mxCell id="vGfOE6fh8Fkg2EA02DIV-4" value="" style="shape=partialRectangle;collapsible=0;dropTarget=0;pointerEvents=0;fillColor=none;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=0;" vertex="1" parent="C-vyLk0tnHw3VtMMgP7b-13">
-          <mxGeometry y="150" width="250" height="30" as="geometry" />
+        <mxCell id="Tb8xqYRGo6f0FsYqac5e-10" value="" style="shape=partialRectangle;collapsible=0;dropTarget=0;pointerEvents=0;fillColor=none;points=[[0,0.5],[1,0.5]];portConstraint=eastwest;top=0;left=0;right=0;bottom=0;" vertex="1" parent="C-vyLk0tnHw3VtMMgP7b-2">
+          <mxGeometry y="240" width="250" height="30" as="geometry" />
         </mxCell>
-        <mxCell id="vGfOE6fh8Fkg2EA02DIV-5" value="" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;" vertex="1" parent="vGfOE6fh8Fkg2EA02DIV-4">
+        <mxCell id="Tb8xqYRGo6f0FsYqac5e-11" value="" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;" vertex="1" parent="Tb8xqYRGo6f0FsYqac5e-10">
           <mxGeometry width="30" height="30" as="geometry">
             <mxRectangle width="30" height="30" as="alternateBounds" />
           </mxGeometry>
         </mxCell>
-        <mxCell id="vGfOE6fh8Fkg2EA02DIV-6" value="resistance int NOT NULL default 3" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;" vertex="1" parent="vGfOE6fh8Fkg2EA02DIV-4">
+        <mxCell id="Tb8xqYRGo6f0FsYqac5e-12" value="mech_1_id" style="shape=partialRectangle;overflow=hidden;connectable=0;fillColor=none;top=0;left=0;bottom=0;right=0;align=left;spacingLeft=6;" vertex="1" parent="Tb8xqYRGo6f0FsYqac5e-10">
           <mxGeometry x="30" width="220" height="30" as="geometry">
             <mxRectangle width="220" height="30" as="alternateBounds" />
           </mxGeometry>

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 8 - 1
tools/api/SquadComposer-soapui-project.xml