fix: billing tenant isolation, invoice status validation, SMTP password masking
H2: list_invoices now passes tenant_id (from current_user) to get_invoices;
get_invoices applies WHERE tenant_id filter for non-global-admin users;
get_invoice_endpoint returns 404 when tenant mismatch for non-admins.
H3: InvoiceStatusUpdate.status changed to Literal["draft","sent","paid","cancelled"]
for schema-level validation; guard also added in update_invoice_status service.
H5: _settings_to_out masks smtp_password as "***" when set, "" when empty;
update_settings skips writing when value is the "***" sentinel.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,7 @@ from __future__ import annotations
|
||||
import uuid
|
||||
from datetime import date, datetime
|
||||
from decimal import Decimal
|
||||
from typing import Literal
|
||||
from pydantic import BaseModel, computed_field
|
||||
|
||||
|
||||
@@ -35,7 +36,7 @@ class InvoiceCreate(BaseModel):
|
||||
|
||||
|
||||
class InvoiceStatusUpdate(BaseModel):
|
||||
status: str # draft|sent|paid|cancelled
|
||||
status: Literal["draft", "sent", "paid", "cancelled"]
|
||||
|
||||
|
||||
class InvoiceOut(BaseModel):
|
||||
|
||||
Reference in New Issue
Block a user