Skip to content

Commit 4ff1ab5

Browse files
committed
change start / end on task runs to range_start / range_end
To better match the rest of the API.
1 parent 61fd593 commit 4ff1ab5

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

missioncontrol/openapi/openapi.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1132,14 +1132,14 @@ paths:
11321132
type: string
11331133
format: uuid
11341134
- in: query
1135-
name: start
1135+
name: range_start
11361136
description:
11371137
Only return files with data after (inclusive) this start time.
11381138
schema:
11391139
type: string
11401140
format: date-time
11411141
- in: query
1142-
name: end
1142+
name: range_end
11431143
description:
11441144
Only return files with data before (inclusive) this end time.
11451145
schema:

missioncontrol/tests/test_files.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ def test_file_search_empty(test_client, some_uuid):
7171
'cid': 'nope',
7272
'where': 'nowhere',
7373
'task_run': some_uuid,
74-
'start': "2018-11-25T00:00:00.000000Z",
75-
'end': "2018-11-25T00:00:00.000000Z",
74+
'range_start': "2018-11-25T00:00:00.000000Z",
75+
'range_end': "2018-11-25T00:00:00.000000Z",
7676
})
7777
assert response.status_code == 200, response.get_data()
7878

@@ -131,16 +131,19 @@ def create_asset(asset_type, asset):
131131
formatter = dateformat.DateFormat(created)
132132
expected['created'] = formatter.format(settings.DATETIME_FORMAT)
133133

134-
simple_file['end'] = simple_file['start']
134+
search_query = simple_file.copy()
135+
search_query['range_start'] = search_query.pop('start')
136+
search_query['range_end'] = search_query['range_start']
135137

136-
response = test_client.get(f'/api/v0/files/', query_string=simple_file)
138+
response = test_client.get(f'/api/v0/files/', query_string=search_query)
137139
assert response.status_code == 200, response.get_data()
138140

139141
assert response.json == [expected]
140142

141143
# Make sure changing some of the searches *DON'T* find it.
142144
simple_query_false = simple_file.copy()
143145
simple_query_false['task_run'] = uuid.uuid4()
146+
simple_query_false['range_start'] = simple_query_false.pop('start')
144147
response = test_client.get(f'/api/v0/files/', query_string=simple_query_false)
145148
assert response.status_code == 200, response.get_data()
146149
assert response.json == []

missioncontrol/v0/files.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ def search(**kwargs):
1010
kwargs.pop('token_info', None)
1111
kwargs.pop('user', None)
1212

13-
start = kwargs.pop('start', None)
13+
start = kwargs.pop('range_start', None)
1414
# Some data
1515
args = []
1616
if start:
1717
args.append(Q(end__gte=start) | (Q(end__isnull=True) & Q(start__gte=start)))
18-
end = kwargs.pop('end', None)
18+
end = kwargs.pop('range_end', None)
1919
if end:
2020
kwargs['start__lte'] = end
2121
results = S3File.objects.filter(*args, **kwargs)

0 commit comments

Comments
 (0)