chore(release): bump version to 1.9.1 and apply pending changes
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
"""
|
||||
|
||||
from datetime import datetime, time
|
||||
from uuid import UUID
|
||||
|
||||
from sqlalchemy import func, select
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
@@ -24,7 +25,7 @@ class PointTransactionCRUD(CRUDBase[PointTransaction]):
|
||||
self,
|
||||
db: AsyncSession,
|
||||
*,
|
||||
user_id: str,
|
||||
user_id: UUID | str,
|
||||
skip: int = 0,
|
||||
limit: int = 50,
|
||||
tx_type: str | None = None,
|
||||
@@ -55,7 +56,7 @@ class PointTransactionCRUD(CRUDBase[PointTransaction]):
|
||||
self,
|
||||
db: AsyncSession,
|
||||
*,
|
||||
user_id: str,
|
||||
user_id: UUID | str,
|
||||
tx_type: str | None = None,
|
||||
category: str | None = None,
|
||||
source_type: str | None = None,
|
||||
@@ -105,18 +106,15 @@ class PointTransactionCRUD(CRUDBase[PointTransaction]):
|
||||
self,
|
||||
db: AsyncSession,
|
||||
*,
|
||||
user_id: str,
|
||||
user_id: UUID | str,
|
||||
) -> int:
|
||||
"""统计用户今日消费积分总和"""
|
||||
now = datetime.now()
|
||||
start_of_day = datetime.combine(now.date(), time.min)
|
||||
stmt = (
|
||||
select(func.coalesce(func.sum(PointTransaction.amount), 0))
|
||||
.where(
|
||||
PointTransaction.user_id == user_id,
|
||||
PointTransaction.type == "consume",
|
||||
PointTransaction.created_at >= start_of_day,
|
||||
)
|
||||
stmt = select(func.coalesce(func.sum(PointTransaction.amount), 0)).where(
|
||||
PointTransaction.user_id == user_id,
|
||||
PointTransaction.type == "consume",
|
||||
PointTransaction.created_at >= start_of_day,
|
||||
)
|
||||
result = await db.execute(stmt)
|
||||
return result.scalar() or 0
|
||||
|
||||
Reference in New Issue
Block a user