fixed db poweron reference - not baseclass
This commit is contained in:
parent
1053d0c715
commit
0c7ab77728
9 changed files with 19 additions and 17 deletions
|
|
@ -9,14 +9,15 @@ for compliance, audit, and data-protection reporting.
|
||||||
import uuid
|
import uuid
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import Field
|
||||||
|
|
||||||
|
from modules.datamodels.datamodelBase import PowerOnModel
|
||||||
from modules.shared.i18nRegistry import i18nModel
|
from modules.shared.i18nRegistry import i18nModel
|
||||||
from modules.shared.timeUtils import getUtcTimestamp
|
from modules.shared.timeUtils import getUtcTimestamp
|
||||||
|
|
||||||
|
|
||||||
@i18nModel("AI-Audit-Eintrag")
|
@i18nModel("AI-Audit-Eintrag")
|
||||||
class AiAuditLogEntry(BaseModel):
|
class AiAuditLogEntry(PowerOnModel):
|
||||||
id: str = Field(
|
id: str = Field(
|
||||||
default_factory=lambda: str(uuid.uuid4()),
|
default_factory=lambda: str(uuid.uuid4()),
|
||||||
description="Primary key",
|
description="Primary key",
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ from pydantic import BaseModel, Field
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
|
from modules.datamodels.datamodelBase import PowerOnModel
|
||||||
from modules.shared.timeUtils import getUtcTimestamp
|
from modules.shared.timeUtils import getUtcTimestamp
|
||||||
from modules.shared.i18nRegistry import i18nModel
|
from modules.shared.i18nRegistry import i18nModel
|
||||||
|
|
||||||
|
|
@ -83,7 +84,7 @@ class AuditAction(str, Enum):
|
||||||
|
|
||||||
|
|
||||||
@i18nModel("Audit-Log-Eintrag")
|
@i18nModel("Audit-Log-Eintrag")
|
||||||
class AuditLogEntry(BaseModel):
|
class AuditLogEntry(PowerOnModel):
|
||||||
"""
|
"""
|
||||||
Audit log entry for database storage.
|
Audit log entry for database storage.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,7 @@ class BillingTransaction(PowerOnModel):
|
||||||
|
|
||||||
|
|
||||||
@i18nModel("Abrechnungseinstellungen")
|
@i18nModel("Abrechnungseinstellungen")
|
||||||
class BillingSettings(BaseModel):
|
class BillingSettings(PowerOnModel):
|
||||||
"""Billing settings per mandate. Only PREPAY_MANDATE model."""
|
"""Billing settings per mandate. Only PREPAY_MANDATE model."""
|
||||||
id: str = Field(
|
id: str = Field(
|
||||||
default_factory=lambda: str(uuid.uuid4()),
|
default_factory=lambda: str(uuid.uuid4()),
|
||||||
|
|
@ -186,7 +186,7 @@ class BillingSettings(BaseModel):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class StripeWebhookEvent(BaseModel):
|
class StripeWebhookEvent(PowerOnModel):
|
||||||
"""Stores processed Stripe webhook event IDs for idempotency."""
|
"""Stores processed Stripe webhook event IDs for idempotency."""
|
||||||
id: str = Field(
|
id: str = Field(
|
||||||
default_factory=lambda: str(uuid.uuid4()),
|
default_factory=lambda: str(uuid.uuid4()),
|
||||||
|
|
@ -201,7 +201,7 @@ class StripeWebhookEvent(BaseModel):
|
||||||
|
|
||||||
|
|
||||||
@i18nModel("Nutzungsstatistik")
|
@i18nModel("Nutzungsstatistik")
|
||||||
class UsageStatistics(BaseModel):
|
class UsageStatistics(PowerOnModel):
|
||||||
"""Aggregated usage statistics for quick retrieval."""
|
"""Aggregated usage statistics for quick retrieval."""
|
||||||
id: str = Field(
|
id: str = Field(
|
||||||
default_factory=lambda: str(uuid.uuid4()),
|
default_factory=lambda: str(uuid.uuid4()),
|
||||||
|
|
|
||||||
|
|
@ -319,7 +319,7 @@ class DocumentExchange(BaseModel):
|
||||||
documents: List[str] = Field(default_factory=list, description="List of document references", json_schema_extra={"label": "Dokumente"})
|
documents: List[str] = Field(default_factory=list, description="List of document references", json_schema_extra={"label": "Dokumente"})
|
||||||
|
|
||||||
@i18nModel("Aufgaben-Aktion")
|
@i18nModel("Aufgaben-Aktion")
|
||||||
class ActionItem(BaseModel):
|
class ActionItem(PowerOnModel):
|
||||||
id: str = Field(..., description="Action ID", json_schema_extra={"label": "Aktions-ID"})
|
id: str = Field(..., description="Action ID", json_schema_extra={"label": "Aktions-ID"})
|
||||||
execMethod: str = Field(..., description="Method to execute", json_schema_extra={"label": "Methode"})
|
execMethod: str = Field(..., description="Method to execute", json_schema_extra={"label": "Methode"})
|
||||||
execAction: str = Field(..., description="Action to perform", json_schema_extra={"label": "Aktion"})
|
execAction: str = Field(..., description="Action to perform", json_schema_extra={"label": "Aktion"})
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,7 @@ class MessagingSubscription(PowerOnModel):
|
||||||
|
|
||||||
|
|
||||||
@i18nModel("Messaging-Registrierung")
|
@i18nModel("Messaging-Registrierung")
|
||||||
class MessagingSubscriptionRegistration(BaseModel):
|
class MessagingSubscriptionRegistration(PowerOnModel):
|
||||||
"""Data model for user registrations to messaging subscriptions"""
|
"""Data model for user registrations to messaging subscriptions"""
|
||||||
id: str = Field(
|
id: str = Field(
|
||||||
default_factory=lambda: str(uuid.uuid4()),
|
default_factory=lambda: str(uuid.uuid4()),
|
||||||
|
|
@ -203,7 +203,7 @@ class MessagingSubscriptionRegistration(BaseModel):
|
||||||
|
|
||||||
|
|
||||||
@i18nModel("Messaging-Zustellung")
|
@i18nModel("Messaging-Zustellung")
|
||||||
class MessagingDelivery(BaseModel):
|
class MessagingDelivery(PowerOnModel):
|
||||||
"""Data model for individual message deliveries"""
|
"""Data model for individual message deliveries"""
|
||||||
id: str = Field(
|
id: str = Field(
|
||||||
default_factory=lambda: str(uuid.uuid4()),
|
default_factory=lambda: str(uuid.uuid4()),
|
||||||
|
|
|
||||||
|
|
@ -153,7 +153,7 @@ class SubscriptionPlan(BaseModel):
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
|
|
||||||
@i18nModel("Stripe-Planpreise")
|
@i18nModel("Stripe-Planpreise")
|
||||||
class StripePlanPrice(BaseModel):
|
class StripePlanPrice(PowerOnModel):
|
||||||
"""Persistierte Zuordnung planKey zu Stripe Product/Price IDs."""
|
"""Persistierte Zuordnung planKey zu Stripe Product/Price IDs."""
|
||||||
id: str = Field(
|
id: str = Field(
|
||||||
default_factory=lambda: str(uuid.uuid4()),
|
default_factory=lambda: str(uuid.uuid4()),
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ class DataNeutraliserConfig(PowerOnModel):
|
||||||
|
|
||||||
|
|
||||||
@i18nModel("Neutralisiertes Datenattribut")
|
@i18nModel("Neutralisiertes Datenattribut")
|
||||||
class DataNeutralizerAttributes(BaseModel):
|
class DataNeutralizerAttributes(PowerOnModel):
|
||||||
"""Zuordnung Originaltext zu Platzhalter fuer neutralisierte Daten."""
|
"""Zuordnung Originaltext zu Platzhalter fuer neutralisierte Daten."""
|
||||||
id: str = Field(
|
id: str = Field(
|
||||||
default_factory=lambda: str(uuid.uuid4()),
|
default_factory=lambda: str(uuid.uuid4()),
|
||||||
|
|
@ -152,7 +152,7 @@ class DataNeutralizerAttributes(BaseModel):
|
||||||
|
|
||||||
|
|
||||||
@i18nModel("Neutralisierungs-Snapshot")
|
@i18nModel("Neutralisierungs-Snapshot")
|
||||||
class DataNeutralizationSnapshot(BaseModel):
|
class DataNeutralizationSnapshot(PowerOnModel):
|
||||||
"""Speichert den vollstaendigen neutralisierten Text (mit Platzhaltern) pro Quelle."""
|
"""Speichert den vollstaendigen neutralisierten Text (mit Platzhaltern) pro Quelle."""
|
||||||
id: str = Field(
|
id: str = Field(
|
||||||
default_factory=lambda: str(uuid.uuid4()),
|
default_factory=lambda: str(uuid.uuid4()),
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@ class GeoPolylinie(BaseModel):
|
||||||
|
|
||||||
|
|
||||||
@i18nModel("Dokument")
|
@i18nModel("Dokument")
|
||||||
class Dokument(BaseModel):
|
class Dokument(PowerOnModel):
|
||||||
"""Supporting data object for file and URL management with versioning."""
|
"""Supporting data object for file and URL management with versioning."""
|
||||||
id: str = Field(
|
id: str = Field(
|
||||||
default_factory=lambda: str(uuid.uuid4()),
|
default_factory=lambda: str(uuid.uuid4()),
|
||||||
|
|
@ -204,7 +204,7 @@ class Kontext(PowerOnModel):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class Land(BaseModel):
|
class Land(PowerOnModel):
|
||||||
"""National level administrative entity."""
|
"""National level administrative entity."""
|
||||||
id: str = Field(
|
id: str = Field(
|
||||||
default_factory=lambda: str(uuid.uuid4()),
|
default_factory=lambda: str(uuid.uuid4()),
|
||||||
|
|
@ -318,7 +318,7 @@ class Kanton(PowerOnModel):
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class Gemeinde(BaseModel):
|
class Gemeinde(PowerOnModel):
|
||||||
"""Municipal level administrative entity."""
|
"""Municipal level administrative entity."""
|
||||||
id: str = Field(
|
id: str = Field(
|
||||||
default_factory=lambda: str(uuid.uuid4()),
|
default_factory=lambda: str(uuid.uuid4()),
|
||||||
|
|
|
||||||
|
|
@ -216,9 +216,9 @@ def _archiveOtherRecurringPrices(
|
||||||
stripe.Price.modify(p.id, active=False)
|
stripe.Price.modify(p.id, active=False)
|
||||||
logger.info("Archived stale Stripe Price %s on product %s", p.id, productId)
|
logger.info("Archived stale Stripe Price %s on product %s", p.id, productId)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
logger.warning("Could not archive price %s: %s", p.id, ex)
|
logger.debug("Could not archive price %s: %s", p.id, ex)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning("Stale price archive pass failed for product %s: %s", productId, e)
|
logger.debug("Stale price archive pass skipped for product %s: %s", productId, e)
|
||||||
|
|
||||||
|
|
||||||
def _validateStripeIdsExist(stripe, mapping: StripePlanPrice) -> bool:
|
def _validateStripeIdsExist(stripe, mapping: StripePlanPrice) -> bool:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue