ifixkart-backend/app/models/NotificationTemplateModel.py
adithiyan 10bfba7d58 feat: add warranties, refunds, notifications, CRM calendar, system config & delivery modules
- New models: WarrantyModel, WalletModel, SystemConfigModel
- New schemas: WarrantySchema, RefundSchema, SystemConfig, CrmTaskCalendar, NotificationTemplate, NotificationGateway, RepairErp, ReviewModeration, InventoryPos, MultiDashboard, BillingFinance
- New services: WarrantyService, RefundService, CrmService, CrmTaskCalendarService, DeliveryService, EmailTemplateService, InventoryPosService, MultiDashboardService, NotificationGatewayService, RepairErpService, ReviewModerationService, SystemConfigService, TemplateService, CreditService
- Updated routers: AdminOrder, BillingFinance, Cart, Catalog, Checkout, Crm, InventoryPos, NotificationGateway, RolePermission, ServiceJob, Settings, Storefront, UserCreation
- Updated models: Inventory, Notification, Order, Product, Service, Setting, SystemConfig, User
- Updated core: database init, invoice generator, main app
- Added WarrantyRouter with full CRUD and claim flow
2026-10-13 22:05:16 +05:30

26 lines
1 KiB
Python

from datetime import datetime, timezone
from sqlalchemy import Column, String, Boolean, DateTime, Text, JSON, UniqueConstraint
import ulid
from app.core.database.db_session import Base
from app.models.audit_base import AuditMixin
class NotificationTemplate(Base, AuditMixin):
__tablename__ = "notification_templates"
template_id = Column(String(36), primary_key=True, default=lambda: str(ulid.ULID()))
tenant_id = Column(String(36), nullable=False, default="tenant_default", index=True)
event_key = Column(String(50), nullable=False, index=True)
name = Column(String(100), nullable=False)
channel = Column(String(20), nullable=False) # WHATSAPP, EMAIL
subject = Column(String(255), nullable=True)
body_content = Column(Text, nullable=False)
variables = Column(JSON, nullable=False, default=list)
is_active = Column(Boolean, nullable=False, default=True)
__table_args__ = (
UniqueConstraint('tenant_id', 'event_key', 'channel', name='uq_tenant_event_channel'),
)