Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(backend): allow usage of "updated_at" attributes #4370

Merged
merged 1 commit into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading