会员积分改版V1
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
|
||||
class CreditBalanceItemOut(BaseModel):
|
||||
id: str
|
||||
credit_level: str
|
||||
source_type: str
|
||||
source_id: str | None = None
|
||||
product_id: str | None = None
|
||||
payment_order_id: str | None = None
|
||||
subscription_id: str | None = None
|
||||
subscription_period_id: str | None = None
|
||||
grant_amount: float
|
||||
unspent_amount: float
|
||||
consumed_amount: float
|
||||
expired_amount: float
|
||||
revoked_amount: float
|
||||
valid_from: datetime
|
||||
expires_at: datetime
|
||||
last_usable_at: datetime
|
||||
status: str
|
||||
created_at: datetime
|
||||
|
||||
|
||||
class CreditBalanceSummaryOut(BaseModel):
|
||||
credits: float
|
||||
available_credits: float
|
||||
next_expiring_credits: float
|
||||
next_expires_at: datetime | None = None
|
||||
next_last_usable_at: datetime | None = None
|
||||
|
||||
|
||||
class AdminCreditGrantRequest(BaseModel):
|
||||
amount: float = Field(..., gt=0, le=999999999.99, multiple_of=0.01)
|
||||
description: str = Field(..., min_length=1, max_length=256)
|
||||
valid_from: datetime | None = None
|
||||
validity_unit: str = Field(default="month", pattern="^(day|month)$")
|
||||
validity_value: int = Field(default=1, ge=1, le=120)
|
||||
credit_level: str = Field(default="general", pattern="^(promotional|general)$")
|
||||
|
||||
|
||||
class AdminCreditDeductRequest(BaseModel):
|
||||
amount: float = Field(..., gt=0, le=999999999.99, multiple_of=0.01)
|
||||
description: str = Field(..., min_length=1, max_length=256)
|
||||
Reference in New Issue
Block a user