Skip to content

Commit 16ce4aa

Browse files
committed
fix: refactor thing API to improve endpoint structure and initialization logic
1 parent c62ff74 commit 16ce4aa

3 files changed

Lines changed: 6 additions & 9 deletions

File tree

api/thing.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,6 @@ async def get_things(
299299
user: viewer_dependency,
300300
session: session_dependency,
301301
# thing_id: int = None,
302-
thing_type: str = None,
303302
within: str = None,
304303
query: str = None,
305304
sort: str = None,
@@ -320,7 +319,6 @@ async def get_things(
320319
session,
321320
sort,
322321
within=within,
323-
thing_type=thing_type,
324322
)
325323

326324

tests/features/steps/api_fixture.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,17 @@
3737
Thing,
3838
LocationThingAssociation,
3939
Sensor,
40-
LexiconTerm,
4140
Group,
4241
GroupThingAssociation,
4342
)
4443
from db.engine import session_ctx
4544

4645
with session_ctx() as session:
47-
if session.query(LexiconTerm).count() == 0:
48-
erase_and_rebuild_db(session)
46+
# if session.query(LexiconTerm).count() == 0:
47+
erase_and_rebuild_db(session)
4948

50-
init_lexicon()
51-
init_parameter()
49+
init_lexicon()
50+
init_parameter()
5251

5352

5453
def add_location(lid):
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
@when('the user requests things with type "water well"')
2121
def step_impl(context):
22-
context.response = context.client.get("/thing", params={"thing_type": "water well"})
22+
context.response = context.client.get("/thing/water-well")
2323

2424

2525
@then("the response should include at least one thing")
@@ -37,7 +37,7 @@ def step_impl(context):
3737

3838
@when('the user requests things with type "spring"')
3939
def step_impl(context):
40-
context.response = context.client.get("/thing", params={"thing_type": "spring"})
40+
context.response = context.client.get("/thing/spring")
4141

4242

4343
@then('the response should only include things of type "spring"')

0 commit comments

Comments
 (0)