Skip to content

Commit f6c2c4e

Browse files
committed
Fix updating Location external_id
1 parent 53746a4 commit f6c2c4e

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

data_rentgen/server/api/v1/router/location.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ async def update_location(
5656
location_service: Annotated[LocationService, Depends()],
5757
current_user: Annotated[User, Depends(get_user())],
5858
) -> LocationDetailedResponseV1:
59-
location = await location_service.update_external_id(location_id, location_data.external_id)
59+
async with location_service:
60+
location = await location_service.update_external_id(location_id, location_data.external_id)
6061
return LocationDetailedResponseV1.model_validate(location)
6162

6263

data_rentgen/server/services/location.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,13 @@ class LocationService:
5757
def __init__(self, uow: Annotated[UnitOfWork, Depends()]):
5858
self._uow = uow
5959

60+
async def __aenter__(self):
61+
await self._uow.__aenter__()
62+
return self
63+
64+
async def __aexit__(self, exc_type, exc_value, traceback):
65+
await self._uow.__aexit__(exc_type, exc_value, traceback)
66+
6067
async def paginate(
6168
self,
6269
page: int,

docs/changelog/0.4.8.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
0.4.8 (2025-01-26)
2+
==================
3+
4+
Fixed issue with updating Location's ``external_id`` field - server returned response coe 200 but ignored the input value.

docs/changelog/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
:caption: Changelog
44

55
DRAFT
6+
0.4.8
67
0.4.7
78
0.4.6
89
0.4.5

0 commit comments

Comments
 (0)