Skip to content

Commit

Permalink
Rename lastUpdatedAt to lastModifiedAt.
Browse files Browse the repository at this point in the history
  • Loading branch information
SyntaxColoring committed Nov 20, 2023
1 parent 4d8ef7f commit 36f4f34
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion api-client/src/deck_configuration/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ export interface UpdateDeckConfigurationRequest {
export interface DeckConfigurationResponse {
data: {
cutoutFixtures: DeckConfiguration
lastUpdatedAt: string
lastModifiedAt: string
}
}
2 changes: 1 addition & 1 deletion robot-server/robot_server/deck_configuration/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class DeckConfigurationResponse(pydantic.BaseModel):
cutoutFixtures: List[CutoutFixture] = pydantic.Field(
description="A full list of all the cutout fixtures that are mounted onto the deck."
)
lastUpdatedAt: Optional[datetime] = pydantic.Field(
lastModifiedAt: Optional[datetime] = pydantic.Field(
description=(
"When the deck configuration was last set over HTTP."
" If that has never happened, this will be `null` or omitted."
Expand Down
4 changes: 2 additions & 2 deletions robot-server/robot_server/deck_configuration/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
async def put_deck_configuration( # noqa: D103
request_body: RequestModel[models.DeckConfigurationRequest],
store: DeckConfigurationStore = fastapi.Depends(get_deck_configuration_store),
last_updated_at: datetime = fastapi.Depends(get_current_time),
now: datetime = fastapi.Depends(get_current_time),
deck_definition: DeckDefinitionV4 = fastapi.Depends(get_deck_definition),
) -> PydanticResponse[
Union[
Expand All @@ -70,7 +70,7 @@ async def put_deck_configuration( # noqa: D103
placements = validation_mapping.map_in(request_body.data)
validation_errors = validation.get_configuration_errors(deck_definition, placements)
if len(validation_errors) == 0:
success_data = await store.set(request_body.data, last_updated_at)
success_data = await store.set(request=request_body.data, last_modified_at=now)
return await PydanticResponse.create(
content=SimpleBody.construct(data=success_data)
)
Expand Down
10 changes: 5 additions & 5 deletions robot-server/robot_server/deck_configuration/store.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def __init__(self, deck_type: DeckType) -> None:
self._calibration_storage_lock = asyncio.Lock()

async def set(
self, request: models.DeckConfigurationRequest, last_updated_at: datetime
self, request: models.DeckConfigurationRequest, last_modified_at: datetime
) -> models.DeckConfigurationResponse:
"""Set the robot's current deck configuration."""
async with self._calibration_storage_lock:
Expand All @@ -40,7 +40,7 @@ async def set(
)
for e in request.cutoutFixtures
],
last_modified=last_updated_at,
last_modified=last_modified_at,
)
return await self._get_assuming_locked()

Expand All @@ -66,10 +66,10 @@ async def _get_assuming_locked(self) -> models.DeckConfigurationResponse:
cutoutFixtures=defaults.for_deck_definition(
self._deck_type.value
).cutoutFixtures,
lastUpdatedAt=None,
lastModifiedAt=None,
)
else:
cutout_fixtures_from_storage, last_updated_at = from_storage
cutout_fixtures_from_storage, last_modified_at = from_storage
cutout_fixtures = [
models.CutoutFixture.construct(
cutoutFixtureId=e.cutout_fixture_id,
Expand All @@ -79,5 +79,5 @@ async def _get_assuming_locked(self) -> models.DeckConfigurationResponse:
]
return models.DeckConfigurationResponse.construct(
cutoutFixtures=cutout_fixtures,
lastUpdatedAt=last_updated_at,
lastModifiedAt=last_modified_at,
)
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ stages:
response:
json:
data:
# lastUpdatedAt is deliberately omitted from this expected object.
# A lastUpdatedAt that's omitted or null means the deck configuration has never been set.
# lastModifiedAt is deliberately omitted from this expected object.
# A lastModifiedAt that's omitted or null means the deck configuration has never been set.
#
# Unfortunately, this makes this test order-dependent with any other tests
# that modify the deck configuration, even if they try to restore the original value
# after they're done. We probably need some kind of deck configuration factory-reset.
#
# lastUpdatedAt: null
# lastModifiedAt: null
cutoutFixtures: &expectedDefaultCutoutFixtures
- cutoutFixtureId: singleLeftSlot
cutoutId: cutoutA1
Expand Down Expand Up @@ -86,11 +86,11 @@ stages:
response:
json:
data:
lastUpdatedAt: !anystr
lastModifiedAt: !anystr
cutoutFixtures: *expectedNonDefaultCutoutFixtures
save:
json:
last_updated_at: data.lastUpdatedAt
last_updated_at: data.lastModifiedAt

- name: Set an invalid deck configuration
request:
Expand Down Expand Up @@ -142,7 +142,7 @@ stages:
response:
json:
data:
lastUpdatedAt: '{last_updated_at}'
lastModifiedAt: '{last_updated_at}'
cutoutFixtures: *expectedNonDefaultCutoutFixtures

# We test this here even though there are separate Tavern tests for POST /settings/reset
Expand All @@ -161,6 +161,6 @@ stages:
response:
json:
data:
# lastUpdatedAt is deliberately omitted from this expected object.
# lastModifiedAt is deliberately omitted from this expected object.
# See notes above.
cutoutFixtures: *expectedDefaultCutoutFixtures

0 comments on commit 36f4f34

Please sign in to comment.