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:
parent
f4d5bf1543
commit
81675fc55f
2 changed files with 13 additions and 2 deletions
|
|
@ -40,6 +40,8 @@ from core.models import (
|
||||||
Vendor,
|
Vendor,
|
||||||
Wishlist,
|
Wishlist,
|
||||||
)
|
)
|
||||||
|
from payments.graphene.object_types import TransactionType
|
||||||
|
from payments.models import Transaction
|
||||||
|
|
||||||
logger = __import__("logging").getLogger(__name__)
|
logger = __import__("logging").getLogger(__name__)
|
||||||
|
|
||||||
|
|
@ -313,6 +315,7 @@ class OrderType(DjangoObjectType):
|
||||||
is_whole_digital = Float(description=_("are all products in the order digital"))
|
is_whole_digital = Float(description=_("are all products in the order digital"))
|
||||||
attributes = GenericScalar(description=_("attributes"))
|
attributes = GenericScalar(description=_("attributes"))
|
||||||
notifications = GenericScalar(description=_("notifications"))
|
notifications = GenericScalar(description=_("notifications"))
|
||||||
|
payments_transactions = Field(TransactionType, description=_("transactions for this order"))
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Order
|
model = Order
|
||||||
|
|
@ -329,6 +332,7 @@ class OrderType(DjangoObjectType):
|
||||||
"total_quantity",
|
"total_quantity",
|
||||||
"is_whole_digital",
|
"is_whole_digital",
|
||||||
"human_readable_id",
|
"human_readable_id",
|
||||||
|
"payments_transactions",
|
||||||
)
|
)
|
||||||
description = _("orders")
|
description = _("orders")
|
||||||
|
|
||||||
|
|
@ -344,6 +348,9 @@ class OrderType(DjangoObjectType):
|
||||||
def resolve_attributes(self, _info):
|
def resolve_attributes(self, _info):
|
||||||
return camelize(self.attributes)
|
return camelize(self.attributes)
|
||||||
|
|
||||||
|
def resolve_payments_transactions(self, _info) -> None | Transaction:
|
||||||
|
return None or self.payments_transactions
|
||||||
|
|
||||||
|
|
||||||
class ProductImageType(DjangoObjectType):
|
class ProductImageType(DjangoObjectType):
|
||||||
image = String(description=_("image url"))
|
image = String(description=_("image url"))
|
||||||
|
|
|
||||||
|
|
@ -138,6 +138,8 @@ services:
|
||||||
- BROKER_URL=${CELERY_BROKER_URL}
|
- BROKER_URL=${CELERY_BROKER_URL}
|
||||||
- TZ=${TIME_ZONE}
|
- TZ=${TIME_ZONE}
|
||||||
depends_on:
|
depends_on:
|
||||||
|
database:
|
||||||
|
condition: service_healthy
|
||||||
redis:
|
redis:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
elasticsearch:
|
elasticsearch:
|
||||||
|
|
@ -164,6 +166,8 @@ services:
|
||||||
- BROKER_URL=${CELERY_BROKER_URL}
|
- BROKER_URL=${CELERY_BROKER_URL}
|
||||||
- TZ=${TIME_ZONE}
|
- TZ=${TIME_ZONE}
|
||||||
depends_on:
|
depends_on:
|
||||||
|
database:
|
||||||
|
condition: service_healthy
|
||||||
redis:
|
redis:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
elasticsearch:
|
elasticsearch:
|
||||||
|
|
@ -190,12 +194,12 @@ services:
|
||||||
- BROKER_URL=${CELERY_BROKER_URL}
|
- BROKER_URL=${CELERY_BROKER_URL}
|
||||||
- TZ=${TIME_ZONE}
|
- TZ=${TIME_ZONE}
|
||||||
depends_on:
|
depends_on:
|
||||||
|
database:
|
||||||
|
condition: service_healthy
|
||||||
worker:
|
worker:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
stock_updater:
|
stock_updater:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
database:
|
|
||||||
condition: service_healthy
|
|
||||||
logging: *default-logging
|
logging: *default-logging
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: [ "CMD", "bash", "-c", "pgrep -f 'celery beat' >/dev/null" ]
|
test: [ "CMD", "bash", "-c", "pgrep -f 'celery beat' >/dev/null" ]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue