- 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
34 lines
1.1 KiB
Python
34 lines
1.1 KiB
Python
from pydantic import BaseModel, Field
|
|
from typing import Optional
|
|
from datetime import datetime
|
|
|
|
class WarrantyBase(BaseModel):
|
|
reference_type: str = Field(..., description="ORDER or SERVICE")
|
|
reference_id: str = Field(..., description="Order ID or Service Job ID")
|
|
product_id: Optional[str] = None
|
|
order_item_id: Optional[str] = None
|
|
service_job_id: Optional[str] = None
|
|
serial_no_imei: Optional[str] = None
|
|
start_date: datetime
|
|
end_date: datetime
|
|
status: str = Field(default="ACTIVE", description="ACTIVE, EXPIRED, VOID")
|
|
warranty_type: str = Field(..., description="PRODUCT, SERVICE, EXTENDED")
|
|
terms: Optional[str] = None
|
|
void_reason: Optional[str] = None
|
|
|
|
class WarrantyCreate(WarrantyBase):
|
|
customer_id: str
|
|
|
|
class WarrantyResponse(WarrantyBase):
|
|
warranty_id: str
|
|
tenant_id: str
|
|
customer_id: str
|
|
expiry_notification_sent: bool
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
class WarrantyVoidRequest(BaseModel):
|
|
void_reason: str = Field(..., description="Reason for voiding the warranty")
|