feat: core inventory API and secure operation routers
This commit is contained in:
40
backend/schemas.py
Normal file
40
backend/schemas.py
Normal file
@@ -0,0 +1,40 @@
|
||||
from pydantic import BaseModel
|
||||
from typing import Optional, List
|
||||
from datetime import datetime
|
||||
|
||||
# --- Items ---
|
||||
class ItemBase(BaseModel):
|
||||
name: str
|
||||
category: str
|
||||
barcode: str
|
||||
quantity: float = 0.0
|
||||
min_quantity: float = 1.0
|
||||
image_url: Optional[str] = None
|
||||
labels_data: Optional[str] = None
|
||||
|
||||
class ItemCreate(ItemBase):
|
||||
pass
|
||||
|
||||
class Item(ItemBase):
|
||||
id: int
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
# --- Operations (Check-in/Check-out Validation) ---
|
||||
class OperationCreate(BaseModel):
|
||||
barcode: str
|
||||
quantity: float
|
||||
user_id: int
|
||||
|
||||
# --- Audit Logs ---
|
||||
class AuditLogResponse(BaseModel):
|
||||
id: int
|
||||
timestamp: datetime
|
||||
user_id: int
|
||||
action: str
|
||||
target_item_id: Optional[int]
|
||||
quantity_change: Optional[float]
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
Reference in New Issue
Block a user