Trails-Through-Shadows / TTS-API

A communication interface between database and applications, including validation and game logic.
https://api.tts-game.fun/swagger-ui/index.html
0 stars 0 forks source link

[BUG] PUT method for parts #28

Closed Firestone82 closed 5 months ago

Firestone82 commented 5 months ago

When updating parts (setting its hexes), it somehow duplicates some hexes instead of removing them..

PUT /parts/1

{
  "id": 1,
  "tag": "Square",
  "hexes": [
    {
      "key": {
        "idPart": 1,
        "id": 1
      },
      "q": 0,
      "r": 0,
      "s": 0
    }
  ]
}

Instead of replacing hexes it creates new one if they dont exists, and those that exists get updated.

rcMarty commented 5 months ago

Wait what Do you want to update only without inserts or?

Firestone82 commented 5 months ago

When sending PUT, this method should override all data of specified object. Currently it only updates those objects that already exists by some id. So when I send PUT without any hexes nothing changes.. But it should have removed all hexes.