
This commit includes: - Project structure setup with FastAPI and SQLite - Database models and schemas for inventory management - CRUD operations for all entities - API endpoints for product, category, supplier, and inventory management - User authentication with JWT tokens - Initial database migration - Comprehensive README with setup instructions
37 lines
683 B
Python
37 lines
683 B
Python
from typing import Optional
|
|
from pydantic import BaseModel
|
|
|
|
|
|
# Shared properties
|
|
class CategoryBase(BaseModel):
|
|
name: Optional[str] = None
|
|
description: Optional[str] = None
|
|
|
|
|
|
# Properties to receive on category creation
|
|
class CategoryCreate(CategoryBase):
|
|
name: str
|
|
|
|
|
|
# Properties to receive on category update
|
|
class CategoryUpdate(CategoryBase):
|
|
pass
|
|
|
|
|
|
# Properties shared by models in DB
|
|
class CategoryInDBBase(CategoryBase):
|
|
id: int
|
|
name: str
|
|
|
|
class Config:
|
|
from_attributes = True
|
|
|
|
|
|
# Properties to return to client
|
|
class Category(CategoryInDBBase):
|
|
pass
|
|
|
|
|
|
# Properties properties stored in DB
|
|
class CategoryInDB(CategoryInDBBase):
|
|
pass |