Skip to content

Commit

Permalink
Merge pull request #4370 from opsmill/fac-IFC-14
Browse files Browse the repository at this point in the history
fix(backend): allow usage of "updated_at" attributes
  • Loading branch information
fatih-acar authored Sep 19, 2024
2 parents 27c44ea + 8a4ec98 commit 72855ef
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions backend/infrahub/core/node/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,9 @@ async def _process_fields(self, fields: dict, db: InfrahubDatabase) -> None:
# -------------------------------------------
# Validate Input
# -------------------------------------------
if "updated_at" in fields and "updated_at" not in self._schema.valid_input_names:
# FIXME: Allow users to use "updated_at" named attributes until we have proper metadata handling
fields.pop("updated_at")
for field_name in fields.keys():
if field_name not in self._schema.valid_input_names:
errors.append(ValidationError({field_name: f"{field_name} is not a valid input for {self.get_kind()}"}))
Expand Down Expand Up @@ -398,6 +401,9 @@ async def load(
self._existing = True

if updated_at:
kwargs["updated_at"] = (
updated_at # FIXME: Allow users to use "updated_at" named attributes until we have proper metadata handling
)
self._updated_at = Timestamp(updated_at)

await self._process_fields(db=db, fields=kwargs)
Expand Down
1 change: 1 addition & 0 deletions changelog/3730.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GraphQL results when querying nodes with `updated_at` named attributes will now return correct values instead of null/None

0 comments on commit 72855ef

Please sign in to comment.