add payment method for panel-4
CI/CD Pipeline / build-and-deploy (push) Successful in 16s
Details
CI/CD Pipeline / build-and-deploy (push) Successful in 16s
Details
This commit is contained in:
parent
cd0f209441
commit
9bdf9c1898
|
|
@ -5,7 +5,7 @@ from typing import Annotated
|
|||
|
||||
from ..messages import MESSAGES
|
||||
from ..dependencies import auth_scheme
|
||||
from ..schemas.payment import Billings, BillingsResponse,Url, Plans, Settlement, Credit, PlansV2 ,BasaCreditRequest
|
||||
from ..schemas.payment import Billings, BillingsResponse, BillingAdmin, Url, Plans, Settlement, Credit, PlansV2, BasaCreditRequest
|
||||
from ..services import (
|
||||
payment as payment_service,
|
||||
auth as auth_service,
|
||||
|
|
|
|||
|
|
@ -59,9 +59,27 @@ class BasaCreditRequest(BaseModel):
|
|||
user_id: UUID
|
||||
amount: int
|
||||
|
||||
class BillingUser(BaseModel):
|
||||
id: UUID | None
|
||||
name: str | None
|
||||
mobile_number: str | None
|
||||
username: str | None
|
||||
|
||||
|
||||
class BillingAdmin(BaseModel):
|
||||
id: int
|
||||
credit: int
|
||||
amount: int
|
||||
ref_id: str | None
|
||||
type: BillingType
|
||||
status: BillingStatus
|
||||
created_at: datetime
|
||||
user: BillingUser | None
|
||||
|
||||
|
||||
class BillingsResponse(BaseModel):
|
||||
total: int
|
||||
page: int
|
||||
size: int
|
||||
total_pages: int
|
||||
items: List[Billing]
|
||||
items: List[BillingAdmin]
|
||||
|
|
@ -121,6 +121,7 @@ async def history_admin(page: int = 1, size: int = 10):
|
|||
# گرفتن دیتای فقط همون صفحه
|
||||
billings = (
|
||||
await base_query
|
||||
.select_related("user")
|
||||
.order_by("-created_at")
|
||||
.offset(offset)
|
||||
.limit(size)
|
||||
|
|
@ -136,6 +137,12 @@ async def history_admin(page: int = 1, size: int = 10):
|
|||
"type": b.type,
|
||||
"status": b.status,
|
||||
"created_at": b.created_at,
|
||||
"user": {
|
||||
"id": b.user_id,
|
||||
"name": b.user.name if b.user else None,
|
||||
"mobile_number": b.user.mobile_number if b.user else None,
|
||||
"username": b.user.username if b.user else None,
|
||||
},
|
||||
}
|
||||
for b in billings
|
||||
]
|
||||
|
|
|
|||
Loading…
Reference in New Issue