Skip to content

DELETE removes more entries than it should #725

Open
@on3iro

Description

@on3iro

maybe related to: #578 #545 #13 #721

Hey, I have the following database model:

{
  "boards": [
    {
      "id": "BOARD1",
      "project": "My Project"
    }
  ],
  "lists": [
    {
      "id": "LIST0",
      "boardId": "BOARD1",
      "title": "To Do",
      "position": 0
    },
    {
      "id": "LIST1",
      "boardId": "BOARD1",
      "title": "Doing",
      "position": 1
    },
    {
      "id": "LIST2",
      "boardId": "BOARD1",
      "title": "Review",
      "position": 2
    },
    {
      "id": "LIST3",
      "boardId": "BOARD1",
      "title": "Closed",
      "position": 3
    }
  ],
  "tasks": [
    {
      "id": "TASK0",
      "previousTaskId": "null",
      "nextTaskId": "TASK1",
      "title": "Do something!",
      "estimate": 30,
      "spent": 10,
      "dueDate": "17.11.2017",
      "listId": "LIST0",
      "boardId": "BOARD1",
      "description": "This is a very intersting task and I will probably do it",
      "userId": "",
      "client": "",
      "status": "done",
      "division": "development"
    },
    {
      "id": "TASK1",
      "previousTaskId": "TASK0",
      "nextTaskId": "null",
      "title": "Create a task board",
      "dueDate": "17.11.2017",
      "userId": "USER2",
      "listId": "LIST0",
      "boardId": "BOARD1",
      "description": "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et",
      "readOnly": true,
      "status": "blocked",
      "division": "design"
    },
    {
      "id": "TASK2",
      "previousTaskId": "null",
      "nextTaskId": "null",
      "title": "Do the dishes!",
      "estimate": 50,
      "spent": 45,
      "dueDate": "17.11.2017",
      "userId": "USER0",
      "listId": "LIST1",
      "boardId": "BOARD1",
      "description": "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et",
      "client": "",
      "division": "design"
    },
    {
      "id": "TASK3",
      "previousTaskId": "null",
      "nextTaskId": "TASK4",
      "title": "Have fun",
      "estimate": 40,
      "spent": 28,
      "dueDate": "17.11.2017",
      "userId": "",
      "listId": "LIST2",
      "boardId": "BOARD1",
      "description": "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et"
    },
    {
      "id": "TASK4",
      "previousTaskId": "TASK3",
      "nextTaskId": "TASK5",
      "title": "Yawn three times",
      "estimate": 40,
      "spent": 5,
      "dueDate": "17.11.2017",
      "userId": "USER1",
      "listId": "LIST2",
      "boardId": "BOARD1",
      "status": "blocked",
      "division": "development"
    },
    {
      "id": "TASK5",
      "previousTaskId": "TASK4",
      "nextTaskId": "TASK6",
      "title": "Boing",
      "estimate": 35,
      "dueDate": "17.11.2017",
      "userId": "USER1",
      "listId": "LIST2",
      "boardId": "BOARD1",
      "client": ""
    },
    {
      "id": "TASK6",
      "previousTaskId": "TASK5",
      "nextTaskId": "null",
      "title": "Ding",
      "estimate": 80,
      "dueDate": "17.11.2017",
      "userId": "USER1",
      "listId": "LIST2",
      "boardId": "BOARD1",
      "status": "done"
    }
  ],
  "users": [
    {
      "id": "USER0",
      "name": "",
      "avatarUrl": "img/male3-256.png"
    },
    {
      "id": "USER1",
      "name": "",
      "avatarUrl": ""
    },
    {
      "id": "USER2",
      "name": "",
      "avatarUrl": "img/photo.jpg"
    }
  ],
  "logging": []
}

If I try to DELETE lets say TASK4 however, instead of just deleting the specified task,
also a few other tasks get (randomly?) deleted:

{
    ...,
"tasks": [
    {
      "id": "TASK1",
      "previousTaskId": "TASK0",
      "nextTaskId": "null",
      "title": "Create a task board",
      "dueDate": "17.11.2017",
      "userId": "USER2",
      "listId": "LIST0",
      "boardId": "BOARD1",
      "description": "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et",
      "readOnly": true,
      "status": "blocked",
      "division": "design"
    },
    {
      "id": "TASK2",
      "previousTaskId": "null",
      "nextTaskId": "null",
      "title": "Do the dishes!",
      "estimate": 50,
      "spent": 45,
      "dueDate": "17.11.2017",
      "userId": "USER0",
      "listId": "LIST1",
      "boardId": "BOARD1",
      "description": "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et",
      "client": "BNW",
      "division": "design"
    },
    {
      "id": "TASK5",
      "previousTaskId": "TASK4",
      "nextTaskId": "TASK6",
      "title": "Boing",
      "estimate": 35,
      "dueDate": "17.11.2017",
      "userId": "USER1",
      "listId": "LIST2",
      "boardId": "BOARD1",
      "client": "ILB"
    },
    {
      "id": "TASK6",
      "previousTaskId": "TASK5",
      "nextTaskId": "null",
      "title": "Ding",
      "estimate": 80,
      "dueDate": "17.11.2017",
      "userId": "USER1",
      "listId": "LIST2",
      "boardId": "BOARD1",
      "status": "done"
    }
}

Any idea what could be the problem here? I have been stuck at this for hours and can't seem to wrap my head around this issue. There seems to be no relationship between the deleted tasks, so I have no clue at all, why json-server is doing this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions