Skip to content

Commit d701167

Browse files
committed
fix:PRComments
1 parent 31d6f4e commit d701167

File tree

4 files changed

+32
-9
lines changed

4 files changed

+32
-9
lines changed

nisystemlink/clients/file/models/_base_file_request.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
from nisystemlink.clients.core._uplink._json_model import JsonModel
22

3-
from ._file_query_order_by import FileLinqQueryOrderBy, SearchFilesOrderBy
4-
53

64
class BaseFileRequest(JsonModel):
75
"""Base class for file request models containing common query parameters."""
@@ -21,11 +19,6 @@ class BaseFileRequest(JsonModel):
2119
How many files to return in the result.
2220
"""
2321

24-
order_by: FileLinqQueryOrderBy | SearchFilesOrderBy | None = None
25-
"""
26-
The property by which to order the files in the response.
27-
"""
28-
2922
order_by_descending: bool | None = False
3023
"""
3124
Whether to sort in descending order.

nisystemlink/clients/file/models/_file_linq_query.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
from nisystemlink.clients.file.models._base_file_request import BaseFileRequest
22
from nisystemlink.clients.file.models._base_file_response import BaseFileResponse
3+
from nisystemlink.clients.file.models._file_query_order_by import FileLinqQueryOrderBy
34

45

56
class FileLinqQueryRequest(BaseFileRequest):
67
"""Request model for LINQ query operations."""
78

8-
pass
9+
order_by: FileLinqQueryOrderBy | None = None
10+
"""
11+
The property by which to order the files in the response.
12+
"""
913

1014

1115
class FileLinqQueryResponse(BaseFileResponse):
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
from nisystemlink.clients.file.models._base_file_request import BaseFileRequest
2+
from nisystemlink.clients.file.models._file_query_order_by import SearchFilesOrderBy
23

34

45
class SearchFilesRequest(BaseFileRequest):
56
"""Request model for searching files."""
67

7-
pass
8+
order_by: SearchFilesOrderBy | None = None
9+
"""
10+
The property by which to order the files in the response.
11+
"""

tests/integration/file/test_file_client.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,28 @@ def test__query_files_linq__filter_returns_no_results(self, client: FileClient):
268268
assert response.total_count.value == 0
269269
assert response.total_count.relation == TotalCountRelation.EQUALS
270270

271+
def test__query_files_linq__total_count_relation_accepts_string(
272+
self, client: FileClient, test_file, random_filename_extension
273+
):
274+
"""Test backward compatibility: TotalCountRelation should accept string values.
275+
276+
TotalCountRelation was previously a plain str type. This test ensures that string
277+
values like 'eq' and 'gte' are still accepted for backward compatibility.
278+
"""
279+
test_file(file_name=random_filename_extension)
280+
281+
query_request = FileLinqQueryRequest(
282+
filter=f'name == "{random_filename_extension}"',
283+
)
284+
response = client.query_files_linq(query=query_request)
285+
286+
assert response.total_count is not None
287+
# Test that the relation can be compared with string values
288+
assert response.total_count.relation == "eq"
289+
assert response.total_count.relation in ["eq", "gte"]
290+
# Also verify enum comparison still works
291+
assert response.total_count.relation == TotalCountRelation.EQUALS # type: ignore[comparison-overlap]
292+
271293
def test__query_files_linq__skip_and_take_pagination(
272294
self, client: FileClient, test_file
273295
):

0 commit comments

Comments
 (0)