Skip to content

Commit e85b33f

Browse files
authored
Batch delete rows view not exist (baserow#4847)
1 parent 9ef8ce9 commit e85b33f

3 files changed

Lines changed: 36 additions & 1 deletion

File tree

backend/src/baserow/contrib/database/api/rows/views.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1587,7 +1587,11 @@ class BatchDeleteRowsView(APIView):
15871587
]
15881588
),
15891589
404: get_error_schema(
1590-
["ERROR_TABLE_DOES_NOT_EXIST", "ERROR_ROW_DOES_NOT_EXIST"]
1590+
[
1591+
"ERROR_TABLE_DOES_NOT_EXIST",
1592+
"ERROR_ROW_DOES_NOT_EXIST",
1593+
"ERROR_VIEW_DOES_NOT_EXIST",
1594+
]
15911595
),
15921596
},
15931597
)
@@ -1603,6 +1607,7 @@ class BatchDeleteRowsView(APIView):
16031607
CannotDeleteRowsInTable: ERROR_CANNOT_DELETE_ROWS_IN_TABLE,
16041608
DeadlockException: ERROR_DATABASE_DEADLOCK,
16051609
FieldDataConstraintException: ERROR_FIELD_DATA_CONSTRAINT,
1610+
ViewDoesNotExist: ERROR_VIEW_DOES_NOT_EXIST,
16061611
}
16071612
)
16081613
@atomic_with_retry_on_deadlock()

backend/tests/baserow/contrib/database/api/rows/test_batch_rows_views.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2380,6 +2380,27 @@ def test_batch_delete_rows_user_not_in_workspace(api_client, data_fixture):
23802380
assert response.json()["error"] == "ERROR_USER_NOT_IN_GROUP"
23812381

23822382

2383+
@pytest.mark.django_db
2384+
@pytest.mark.api_rows
2385+
def test_batch_delete_rows_view_does_not_exist(api_client, data_fixture):
2386+
user, jwt_token = data_fixture.create_user_and_token()
2387+
table = data_fixture.create_database_table(user=user)
2388+
model = table.get_model()
2389+
row_1 = model.objects.create()
2390+
request_body = {"items": [row_1.id]}
2391+
url = reverse("api:database:rows:batch-delete", kwargs={"table_id": table.id})
2392+
2393+
response = api_client.post(
2394+
f"{url}?view=-1",
2395+
request_body,
2396+
format="json",
2397+
HTTP_AUTHORIZATION=f"JWT {jwt_token}",
2398+
)
2399+
2400+
assert response.status_code == HTTP_404_NOT_FOUND, response.json()
2401+
assert response.json()["error"] == "ERROR_VIEW_DOES_NOT_EXIST"
2402+
2403+
23832404
@pytest.mark.django_db
23842405
@pytest.mark.api_rows
23852406
def test_batch_delete_rows_invalid_table_id(api_client, data_fixture):
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"type": "bug",
3+
"message": "Return 404 when view doesn't exist in batch delete rows endpoint.",
4+
"issue_origin": "github",
5+
"issue_number": null,
6+
"domain": "database",
7+
"bullet_points": [],
8+
"created_at": "2026-02-20"
9+
}

0 commit comments

Comments
 (0)