restore composer.json, add mysqli extension
Some checks failed
Build and Push to Docker Hub / build-test-push (push) Failing after 1m46s
Some checks failed
Build and Push to Docker Hub / build-test-push (push) Failing after 1m46s
This commit is contained in:
@@ -69,5 +69,8 @@ class DebtSerializer(serializers.ModelSerializer):
|
|||||||
|
|
||||||
message = f"Hurmatli {instance.market.user_id.first_name} {instance.market.user_id.last_name} , Sizning Gold-eggs.uz tuxum yetkazib berish xizmati ilovasidagi xaridingizga {instance.debt_price} so'm qarz yechildi Umumiy balans: {instance.market.debt_unpaid} so'm Batafsil: +998914249515"
|
message = f"Hurmatli {instance.market.user_id.first_name} {instance.market.user_id.last_name} , Sizning Gold-eggs.uz tuxum yetkazib berish xizmati ilovasidagi xaridingizga {instance.debt_price} so'm qarz yechildi Umumiy balans: {instance.market.debt_unpaid} so'm Batafsil: +998914249515"
|
||||||
|
|
||||||
send_sms_msg.delay(instance.market.user_id.phone, message)
|
try:
|
||||||
|
send_sms_msg.delay(instance.market.user_id.phone, message)
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
return instance
|
return instance
|
||||||
|
|||||||
@@ -45,5 +45,5 @@ def send_notification(sender, instance, created, **kwargs): # noqa
|
|||||||
logger.info(f"{response.success_count} notifications sent successfully")
|
logger.info(f"{response.success_count} notifications sent successfully")
|
||||||
else:
|
else:
|
||||||
logger.warning("No users with valid FCM tokens found")
|
logger.warning("No users with valid FCM tokens found")
|
||||||
except exceptions.FirebaseError as e:
|
except Exception as e:
|
||||||
logger.error(f"Failed to send notification: {e}")
|
logger.error(f"Failed to send notification: {e}")
|
||||||
|
|||||||
@@ -60,14 +60,22 @@ class AddDebtView(APIView):
|
|||||||
)
|
)
|
||||||
def post(self, request, *args, **kwargs):
|
def post(self, request, *args, **kwargs):
|
||||||
market_id = request.data.get("market_id")
|
market_id = request.data.get("market_id")
|
||||||
price = Decimal(request.data.get("price"))
|
raw_price = request.data.get("price")
|
||||||
|
|
||||||
if not all([market_id, price]):
|
if not all([market_id, raw_price]):
|
||||||
return Response(
|
return Response(
|
||||||
{"error": "Both market_id and price are required."},
|
{"error": "Both market_id and price are required."},
|
||||||
status=status.HTTP_400_BAD_REQUEST,
|
status=status.HTTP_400_BAD_REQUEST,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
try:
|
||||||
|
price = Decimal(str(raw_price))
|
||||||
|
except Exception:
|
||||||
|
return Response(
|
||||||
|
{"error": "Invalid price value."},
|
||||||
|
status=status.HTTP_400_BAD_REQUEST,
|
||||||
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
market = Market.objects.get(pk=market_id)
|
market = Market.objects.get(pk=market_id)
|
||||||
except Market.DoesNotExist:
|
except Market.DoesNotExist:
|
||||||
@@ -100,7 +108,10 @@ class AddDebtView(APIView):
|
|||||||
|
|
||||||
message = f"Hurmatli {market.user_id.first_name} {market.user_id.last_name}, Sizning Gold-eggs.uz tuxum yetkazib berish xizmati ilovasidagi xaridingizga {price} so'm qarz qo'shib qo'yildi Umumiy balans: {market.debt_unpaid} so'm Batafsil: +998914249515"
|
message = f"Hurmatli {market.user_id.first_name} {market.user_id.last_name}, Sizning Gold-eggs.uz tuxum yetkazib berish xizmati ilovasidagi xaridingizga {price} so'm qarz qo'shib qo'yildi Umumiy balans: {market.debt_unpaid} so'm Batafsil: +998914249515"
|
||||||
|
|
||||||
send_sms_msg.delay(market.user_id.phone, message)
|
try:
|
||||||
|
send_sms_msg.delay(market.user_id.phone, message)
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
return Response(
|
return Response(
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user