Support smooth upgrade
This commit is contained in:
1 parent
be7033e9a2
commit
e42e5ad752
7 files changed
+258
-50
No files matched your search
@@ -26,7 +26,7 @@ def get_user_order_list(
|
||||
):
|
||||
"""Get paginated list of user order history."""
|
||||
offset = (page - 1) * page_size
|
||||
total, orders = user_wallet_history_service.success_order_list(offset, page_size)
|
||||
total, orders = user_wallet_history_service.success_deposit_order_list(offset, page_size)
|
||||
if not orders:
|
||||
return ResponseUtils.success_page(data=[], total=total, page_num=page, page_size=page_size)
|
||||
result = []
|
||||
|
||||
@@ -214,7 +214,7 @@ class UserWalletHistoryRepository:
|
||||
self.db.rollback()
|
||||
return False
|
||||
|
||||
def success_order_list(self, offset: int, limit: int) -> Tuple[int, List[UserWalletHistory]]:
|
||||
def success_deposit_order_list(self, offset: int, limit: int) -> Tuple[int, List[UserWalletHistory]]:
|
||||
"""
|
||||
Get list of successful orders.
|
||||
|
||||
@@ -225,12 +225,15 @@ class UserWalletHistoryRepository:
|
||||
Returns:
|
||||
tuple: (total_count, order_list)
|
||||
"""
|
||||
total = self.db.query(UserWalletHistory).filter(UserWalletHistory.status == 1).count()
|
||||
query = self.db.query(UserWalletHistory).filter(
|
||||
UserWalletHistory.status == 1,
|
||||
UserWalletHistory.type == TransactionType.DEPOSIT,
|
||||
)
|
||||
total = query.count()
|
||||
if total < offset:
|
||||
return total, []
|
||||
history = (
|
||||
self.db.query(UserWalletHistory)
|
||||
.filter(UserWalletHistory.status == 1)
|
||||
query
|
||||
.order_by(UserWalletHistory.created_at.desc())
|
||||
.offset(offset)
|
||||
.limit(limit)
|
||||
|
||||
@@ -15,8 +15,8 @@ class UserWalletHistoryService:
|
||||
def add_refund(self, user_id: str, amount: float, payment_method: str, transaction_id: str) -> UserWalletHistory:
|
||||
return self.user_wallet_history_repository.add_refund(user_id, amount, payment_method, transaction_id)
|
||||
|
||||
def success_order_list(self, offset: int, limit: int) -> Tuple[int, List[UserWalletHistory]]:
|
||||
return self.user_wallet_history_repository.success_order_list(offset, limit)
|
||||
def success_deposit_order_list(self, offset: int, limit: int) -> Tuple[int, List[UserWalletHistory]]:
|
||||
return self.user_wallet_history_repository.success_deposit_order_list(offset, limit)
|
||||
|
||||
def order_list(self, payment_method: str, status: int, start: Optional[datetime] = None, end: Optional[datetime] = None) -> List[UserWalletHistory]:
|
||||
return self.user_wallet_history_repository.order_list(payment_method, status, start, end)
|
||||
|
||||
Reference in new issue
Block a user