This commit is contained in:
@@ -70,7 +70,7 @@ def requires_credits(
|
||||
|
||||
# Validate credits before execution
|
||||
await credit_service.validate_and_reserve_credits(
|
||||
user_id, action_type, metadata,
|
||||
user_id, action_type,
|
||||
)
|
||||
|
||||
# Execute the function
|
||||
@@ -86,7 +86,7 @@ def requires_credits(
|
||||
finally:
|
||||
# Deduct credits based on success
|
||||
await credit_service.deduct_credits(
|
||||
user_id, action_type, success, metadata,
|
||||
user_id, action_type, success=success, metadata=metadata,
|
||||
)
|
||||
|
||||
return wrapper # type: ignore[return-value]
|
||||
@@ -173,7 +173,7 @@ class CreditManager:
|
||||
async def __aenter__(self) -> "CreditManager":
|
||||
"""Enter context manager - validate credits."""
|
||||
await self.credit_service.validate_and_reserve_credits(
|
||||
self.user_id, self.action_type, self.metadata,
|
||||
self.user_id, self.action_type,
|
||||
)
|
||||
self.validated = True
|
||||
return self
|
||||
@@ -189,7 +189,7 @@ class CreditManager:
|
||||
# If no exception occurred, consider it successful
|
||||
success = exc_type is None and self.success
|
||||
await self.credit_service.deduct_credits(
|
||||
self.user_id, self.action_type, success, self.metadata,
|
||||
self.user_id, self.action_type, success=success, metadata=self.metadata,
|
||||
)
|
||||
|
||||
def mark_success(self) -> None:
|
||||
|
||||
Reference in New Issue
Block a user