test updates to take into account exception management
This commit is contained in:
@@ -1,31 +1,26 @@
|
||||
import re
|
||||
# stock.py - Remove business logic validation constraints
|
||||
from datetime import datetime
|
||||
from typing import List, Optional
|
||||
from pydantic import BaseModel, ConfigDict, Field
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, EmailStr, Field, field_validator
|
||||
|
||||
|
||||
# Stock Models
|
||||
class StockBase(BaseModel):
|
||||
gtin: str = Field(..., min_length=1, description="GTIN is required")
|
||||
location: str = Field(..., min_length=1, description="Location is required")
|
||||
|
||||
gtin: str = Field(..., description="GTIN identifier")
|
||||
location: str = Field(..., description="Storage location")
|
||||
|
||||
class StockCreate(StockBase):
|
||||
quantity: int = Field(ge=0, description="Quantity must be non-negative")
|
||||
|
||||
quantity: int = Field(..., description="Initial stock quantity")
|
||||
# Removed: ge=0 constraint - let service handle negative validation
|
||||
|
||||
class StockAdd(StockBase):
|
||||
quantity: int = Field(gt=0, description="Quantity to add must be positive")
|
||||
|
||||
quantity: int = Field(..., description="Quantity to add/remove")
|
||||
# Removed: gt=0 constraint - let service handle zero/negative validation
|
||||
|
||||
class StockUpdate(BaseModel):
|
||||
quantity: int = Field(ge=0, description="Quantity must be non-negative")
|
||||
|
||||
quantity: int = Field(..., description="New stock quantity")
|
||||
# Removed: ge=0 constraint - let service handle negative validation
|
||||
|
||||
class StockResponse(BaseModel):
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: int
|
||||
gtin: str
|
||||
location: str
|
||||
@@ -33,12 +28,10 @@ class StockResponse(BaseModel):
|
||||
created_at: datetime
|
||||
updated_at: datetime
|
||||
|
||||
|
||||
class StockLocationResponse(BaseModel):
|
||||
location: str
|
||||
quantity: int
|
||||
|
||||
|
||||
class StockSummaryResponse(BaseModel):
|
||||
gtin: str
|
||||
total_quantity: int
|
||||
|
||||
Reference in New Issue
Block a user