Skip to content

Commit

Permalink
Fix where clause tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
jgadling committed Jun 20, 2024
1 parent bb361c4 commit 1eb042d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion platformics/api/types/entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ async def resolve_node(cls, node_id: str, info: Info, required: bool = False) ->
db_module = info.context["db_module"]
gql_type: str = cls.__strawberry_definition__.name # type: ignore
sql_model = getattr(db_module, gql_type)
res = (await dataloader.resolve_nodes(sql_model, [node_id]))
res = await dataloader.resolve_nodes(sql_model, [node_id])
if res:
return res[0]
3 changes: 2 additions & 1 deletion platformics/test_infra/factories/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ def update_file_ids(cls) -> None:
session.execute(
sa.text(
f"""UPDATE {entity_name} SET {entity_field_name}_id = file.id
FROM file WHERE {entity_name}.entity_id = file.entity_id""",
FROM file WHERE {entity_name}.entity_id = file.entity_id and file.entity_field_name = :field_name""",
),
{"field_name": entity_field_name},
)
session.commit()
4 changes: 2 additions & 2 deletions test_app/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,8 @@ init:
$(docker_compose_run) $(APP_CONTAINER) black .
# $(docker_compose_run) $(CONTAINER) ruff check --fix .
$(docker_compose_run) $(APP_CONTAINER) sh -c 'strawberry export-schema main:schema > /app/api/schema.graphql'
sleep 5 # wait for the app to reload after having files updated.
docker compose up -d
sleep 5
sleep 5 # wait for the app to reload after having files updated.
docker compose exec $(APP_CONTAINER) python3 -m sgqlc.introspection --exclude-deprecated --exclude-description http://localhost:9009/graphql api/schema.json

.PHONY: clean
Expand All @@ -55,6 +54,7 @@ clean: ## Remove all codegen'd artifacts.
rm -rf cerbos
rm -rf support
rm -rf database
rm -rf test_infra
$(docker_compose) --profile '*' down

.PHONY: start
Expand Down

0 comments on commit 1eb042d

Please sign in to comment.