first commit
This commit is contained in:
commit
3e4574dcdd
163 files changed
+3559
No files matched your search
@@ -0,0 +1,33 @@
|
||||
from django.contrib.auth import get_user_model
|
||||
from rest_framework.exceptions import ValidationError
|
||||
from apps.order.models import Order as OrderModel
|
||||
from utils.services.sms_task import task_send_sms
|
||||
CUserModel = get_user_model()
|
||||
|
||||
|
||||
def update_order(id: int, status: str, code: str, desc: str):
|
||||
try:
|
||||
OrderModel.objects.filter(id=id).update(
|
||||
code=code,
|
||||
desc=desc,
|
||||
status=status
|
||||
)
|
||||
|
||||
order = OrderModel.objects.get(id=id)
|
||||
|
||||
message = f'لوله گستر گلپایگان: مجری محترم درخواست شما برای {order.name} تایید شد '
|
||||
# build new
|
||||
|
||||
task_send_sms.delay(message=message, mobile=order.cuser_mojri.mobile)
|
||||
|
||||
return True
|
||||
except Exception as e:
|
||||
raise ValidationError({"error": f'error update order status ${e}'})
|
||||
|
||||
|
||||
def update_mojri_status(id: int, mojri_status: str = 'WT'):
|
||||
try:
|
||||
CUserModel.objects.filter(id=id).update(mojri_status=mojri_status)
|
||||
return True
|
||||
except Exception as e:
|
||||
raise ValidationError({"error": f'error update mojri status ${e}'})
|
||||
Reference in new issue
Block a user