feat(T06): Verkaufsmodul + Rechtsdokumente + DATEV-Export + Sales UI
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
"""Pydantic schemas for DATEV export request and response bodies."""
|
||||
|
||||
import uuid
|
||||
from datetime import date, datetime
|
||||
from decimal import Decimal
|
||||
from typing import Optional
|
||||
|
||||
from pydantic import BaseModel, ConfigDict, Field, model_validator
|
||||
|
||||
|
||||
class DATEVExportCreate(BaseModel):
|
||||
"""POST /api/v1/datev/export request body."""
|
||||
|
||||
start_date: date = Field(..., description="Start date of the export range")
|
||||
end_date: date = Field(..., description="End date of the export range (inclusive)")
|
||||
|
||||
@model_validator(mode="after")
|
||||
def validate_date_range(self) -> "DATEVExportCreate":
|
||||
"""Ensure start_date is not after end_date."""
|
||||
if self.start_date > self.end_date:
|
||||
raise ValueError("start_date must not be after end_date")
|
||||
return self
|
||||
|
||||
|
||||
class DATEVExportResponse(BaseModel):
|
||||
"""DATEV export response schema."""
|
||||
|
||||
model_config = ConfigDict(from_attributes=True)
|
||||
|
||||
id: uuid.UUID
|
||||
start_date: date
|
||||
end_date: date
|
||||
file_path: Optional[str] = None
|
||||
total_amount: Decimal
|
||||
created_at: Optional[datetime] = None
|
||||
|
||||
|
||||
class DATEVExportListResponse(BaseModel):
|
||||
"""Paginated DATEV export list response."""
|
||||
|
||||
items: list[DATEVExportResponse]
|
||||
total: int
|
||||
page: int
|
||||
page_size: int
|
||||
Reference in New Issue
Block a user