Skip to content

Commit

Permalink
fix: undo remove id resolver (#490)
Browse files Browse the repository at this point in the history
  • Loading branch information
vncsna authored Nov 14, 2023
1 parent 0efb251 commit 8e3fa3a
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion bd_api/custom/graphql_auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ def convert_file_to_url(field, registry=None):
return FileFieldScalar(description=field.help_text, required=not field.null)


def id_resolver(self, *_):
return self.id


def fields_for_form(form, only_fields, exclude_fields):
fields = OrderedDict()
for name, field in form.fields.items():
Expand Down Expand Up @@ -395,7 +399,11 @@ def build_custom_attrs(attributes: dict, model):
if model_name in EXEMPTED_MODELS:
continue
meta = create_model_object_meta(model)
attributes = dict(Meta=meta)
attributes = dict(
Meta=meta,
_id=UUID(name="_id"),
resolve__id=id_resolver,
)
attributes = build_custom_attrs(attributes, model)
node = type(f"{model_name}Node", (DjangoObjectType,), attributes)
queries.update({f"{model_name}Node": PlainTextNode.Field(node)})
Expand Down

0 comments on commit 8e3fa3a

Please sign in to comment.