fix: resolve architecture warnings (SVC-006, FE-008, FE-004)
- Move db.commit() from admin_subscription_service to API endpoints - Add noqa comments for intentional number inputs in templates - Add noqa comment for inline modal in subscriptions.html 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -78,6 +78,8 @@ def create_subscription_tier(
|
||||
):
|
||||
"""Create a new subscription tier."""
|
||||
tier = admin_subscription_service.create_tier(db, tier_data.model_dump())
|
||||
db.commit()
|
||||
db.refresh(tier)
|
||||
return SubscriptionTierResponse.model_validate(tier)
|
||||
|
||||
|
||||
@@ -91,6 +93,8 @@ def update_subscription_tier(
|
||||
"""Update a subscription tier."""
|
||||
update_data = tier_data.model_dump(exclude_unset=True)
|
||||
tier = admin_subscription_service.update_tier(db, tier_code, update_data)
|
||||
db.commit()
|
||||
db.refresh(tier)
|
||||
return SubscriptionTierResponse.model_validate(tier)
|
||||
|
||||
|
||||
@@ -106,6 +110,7 @@ def delete_subscription_tier(
|
||||
Sets is_active=False rather than deleting to preserve history.
|
||||
"""
|
||||
admin_subscription_service.deactivate_tier(db, tier_code)
|
||||
db.commit()
|
||||
|
||||
|
||||
# ============================================================================
|
||||
@@ -190,6 +195,8 @@ def update_vendor_subscription(
|
||||
"""
|
||||
data = update_data.model_dump(exclude_unset=True)
|
||||
sub, vendor = admin_subscription_service.update_subscription(db, vendor_id, data)
|
||||
db.commit()
|
||||
db.refresh(sub)
|
||||
|
||||
return VendorSubscriptionWithVendor(
|
||||
**VendorSubscriptionResponse.model_validate(sub).model_dump(),
|
||||
|
||||
@@ -73,8 +73,6 @@ class AdminSubscriptionService:
|
||||
|
||||
tier = SubscriptionTier(**tier_data)
|
||||
db.add(tier)
|
||||
db.commit()
|
||||
db.refresh(tier)
|
||||
|
||||
logger.info(f"Created subscription tier: {tier.code}")
|
||||
return tier
|
||||
@@ -88,9 +86,6 @@ class AdminSubscriptionService:
|
||||
for field, value in update_data.items():
|
||||
setattr(tier, field, value)
|
||||
|
||||
db.commit()
|
||||
db.refresh(tier)
|
||||
|
||||
logger.info(f"Updated subscription tier: {tier.code}")
|
||||
return tier
|
||||
|
||||
@@ -117,7 +112,6 @@ class AdminSubscriptionService:
|
||||
)
|
||||
|
||||
tier.is_active = False
|
||||
db.commit()
|
||||
|
||||
logger.info(f"Soft-deleted subscription tier: {tier.code}")
|
||||
|
||||
@@ -192,9 +186,6 @@ class AdminSubscriptionService:
|
||||
for field, value in update_data.items():
|
||||
setattr(sub, field, value)
|
||||
|
||||
db.commit()
|
||||
db.refresh(sub)
|
||||
|
||||
logger.info(
|
||||
f"Admin updated subscription for vendor {vendor_id}: {list(update_data.keys())}"
|
||||
)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{# app/templates/admin/subscription-tiers.html #}
|
||||
{# noqa: FE-008 - Using raw number inputs for cents/limits in admin tier config modal #}
|
||||
{% extends "admin/base.html" %}
|
||||
{% from 'shared/macros/alerts.html' import alert_dynamic, error_state %}
|
||||
{% from 'shared/macros/headers.html' import page_header_refresh %}
|
||||
|
||||
@@ -228,6 +228,8 @@
|
||||
{{ pagination_full() }}
|
||||
|
||||
<!-- Edit Modal -->
|
||||
{# noqa: FE-004 - Inline modal required for complex subscription edit form #}
|
||||
{# noqa: FE-008 - Using raw number inputs for custom limit overrides #}
|
||||
<div x-show="showModal" x-cloak class="fixed inset-0 z-50 flex items-center justify-center overflow-auto bg-black bg-opacity-50">
|
||||
<div class="relative w-full max-w-lg p-6 mx-4 bg-white rounded-lg shadow-xl dark:bg-gray-800" @click.away="closeModal()">
|
||||
<h3 class="text-lg font-semibold text-gray-900 dark:text-white mb-4">Edit Subscription</h3>
|
||||
|
||||
@@ -120,6 +120,7 @@
|
||||
Pricing
|
||||
</h3>
|
||||
<div class="grid gap-4 md:grid-cols-3">
|
||||
{# noqa: FE-008 - Using raw number input for price field #}
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 dark:text-gray-400 mb-1">Price</label>
|
||||
<input
|
||||
|
||||
@@ -147,6 +147,7 @@
|
||||
Pricing
|
||||
</h3>
|
||||
<div class="grid gap-4 md:grid-cols-2 lg:grid-cols-4">
|
||||
{# noqa: FE-008 - Using raw number input for price with EUR prefix #}
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 dark:text-gray-400 mb-1">
|
||||
Price (incl. VAT) <span class="text-red-500">*</span>
|
||||
|
||||
Reference in New Issue
Block a user