Features: 1) Add service_healthy condition for database in docker-compose.yml dependencies; 2) Add payments_transactions field to OrderType GraphQL schema.

Fixes: 1) Add missing imports for `TransactionType` and `Transaction` in `graphene.object_types.py`.

Extra: 1) Update `docker-compose.yml` and GraphQL schema for improved service health checks and payment transaction resolution.
This commit is contained in:
Egor Pavlovich Gorbunov 2025-07-02 16:52:59 +03:00
parent f4d5bf1543
commit 81675fc55f
2 changed files with 13 additions and 2 deletions

View file

@ -40,6 +40,8 @@ from core.models import (
Vendor,
Wishlist,
)
from payments.graphene.object_types import TransactionType
from payments.models import Transaction
logger = __import__("logging").getLogger(__name__)
@ -313,6 +315,7 @@ class OrderType(DjangoObjectType):
is_whole_digital = Float(description=_("are all products in the order digital"))
attributes = GenericScalar(description=_("attributes"))
notifications = GenericScalar(description=_("notifications"))
payments_transactions = Field(TransactionType, description=_("transactions for this order"))
class Meta:
model = Order
@ -329,6 +332,7 @@ class OrderType(DjangoObjectType):
"total_quantity",
"is_whole_digital",
"human_readable_id",
"payments_transactions",
)
description = _("orders")
@ -344,6 +348,9 @@ class OrderType(DjangoObjectType):
def resolve_attributes(self, _info):
return camelize(self.attributes)
def resolve_payments_transactions(self, _info) -> None | Transaction:
return None or self.payments_transactions
class ProductImageType(DjangoObjectType):
image = String(description=_("image url"))

View file

@ -138,6 +138,8 @@ services:
- BROKER_URL=${CELERY_BROKER_URL}
- TZ=${TIME_ZONE}
depends_on:
database:
condition: service_healthy
redis:
condition: service_healthy
elasticsearch:
@ -164,6 +166,8 @@ services:
- BROKER_URL=${CELERY_BROKER_URL}
- TZ=${TIME_ZONE}
depends_on:
database:
condition: service_healthy
redis:
condition: service_healthy
elasticsearch:
@ -190,12 +194,12 @@ services:
- BROKER_URL=${CELERY_BROKER_URL}
- TZ=${TIME_ZONE}
depends_on:
database:
condition: service_healthy
worker:
condition: service_healthy
stock_updater:
condition: service_healthy
database:
condition: service_healthy
logging: *default-logging
healthcheck:
test: [ "CMD", "bash", "-c", "pgrep -f 'celery beat' >/dev/null" ]