fix(billing): make quota seed and column names match the product SSOT

The product plan is the only source for quota numbers, but the 0001 seed
used a second set (agent_chat 20/50, tryon hard 10) and omitted hairstyle,
hd_export and report regen. Migration 0003 replaces the seed and renames
points_reserved → quota_reserved and bonus_value → bonus_granted so the
docs and the schema stop contradicting each other.

Effective limit now clips at hard_cap. CI runs the integration slice
against the Postgres/Redis services it already starts.
This commit is contained in:
xsl
2026-08-14 11:28:35 +08:00
parent c97f8ae3e1
commit 2009aa938c
11 changed files with 179 additions and 16 deletions
+3 -3
View File
@@ -42,11 +42,11 @@ class TaskService:
task_type: TaskType,
idempotency_key: str,
payload: dict[str, Any] | None = None,
points_reserved: int = 0,
quota_reserved: int = 0,
reserve_tx_id: int | None = None,
eta_seconds: int | None = None,
) -> Task:
"""Create a task. FR-TASK-05: 相同幂等键返回同一任务,不重复扣点。"""
"""Create a task. FR-TASK-05: 相同幂等键返回同一任务,不重复扣减配额。"""
existing = await repo.find_by_idempotency_key(self._session, idempotency_key)
if existing is not None:
return existing
@@ -61,7 +61,7 @@ class TaskService:
progress=progress_for(TaskStatus.PENDING),
idempotency_key=idempotency_key,
payload=payload or {},
points_reserved=points_reserved,
quota_reserved=quota_reserved,
reserve_tx_id=reserve_tx_id,
eta_seconds=eta_seconds,
),