Skip to content

Commit

Permalink
fix(backend): allow usage of "updated_at" attributes
Browse files Browse the repository at this point in the history
Signed-off-by: Fatih Acar <fatih@opsmill.com>
  • Loading branch information
fatih-acar committed Sep 18, 2024
1 parent 6330b65 commit 8a4ec98
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 8a4ec98

Please sign in to comment.