ifixkart-backend/app/schemas/User.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

60 lines
2.3 KiB
Python

from pydantic import BaseModel, EmailStr, Field
from typing import Optional
from datetime import date, datetime
class UserCreate(BaseModel):
first_name: str = Field(..., min_length=2, max_length=50)
last_name: str = Field(..., min_length=2, max_length=50)
display_name: Optional[str] = Field(None, max_length=100)
email: EmailStr
phone: str = Field(..., min_length=10, max_length=20)
password: str
gender: Optional[str] = Field(None, max_length=20)
dob: Optional[date] = None
department_id: str = Field(..., min_length=26, max_length=26)
designation_id: str = Field(..., min_length=26, max_length=26)
role_id: str = Field(..., min_length=26, max_length=26)
manager_id: Optional[str] = Field(None, min_length=26, max_length=26)
location_ids: Optional[list[str]] = Field(default_factory=list)
class UserUpdate(BaseModel):
first_name: Optional[str] = Field(None, min_length=2, max_length=50)
last_name: Optional[str] = Field(None, min_length=2, max_length=50)
display_name: Optional[str] = Field(None, max_length=100)
email: Optional[EmailStr] = None
phone: Optional[str] = Field(None, min_length=10, max_length=20)
password: Optional[str] = None
gender: Optional[str] = Field(None, max_length=20)
dob: Optional[date] = None
department_id: Optional[str] = Field(None, min_length=26, max_length=26)
designation_id: Optional[str] = Field(None, min_length=26, max_length=26)
role_id: Optional[str] = Field(None, min_length=26, max_length=26)
manager_id: Optional[str] = Field(None, min_length=26, max_length=26)
profile_image_id: Optional[str] = Field(None, min_length=26, max_length=26)
location_ids: Optional[list[str]] = None
class UserResponse(BaseModel):
user_id: str
employee_code: Optional[str]
first_name: str
last_name: str
display_name: Optional[str]
email: EmailStr
phone: str
profile_image_id: Optional[str]
gender: Optional[str]
dob: Optional[date]
department_id: str
designation_id: str
role_id: str
manager_id: Optional[str]
is_active: bool
email_verified: bool
phone_verified: bool
created_at: datetime
last_login: Optional[datetime] = None
last_activity: Optional[str] = None
location_ids: list[str] = []
class Config:
from_attributes = True