Files
timemaster/backend/app/schemas/hours_payout.py
T
patrickandClaude Opus 4.8 1978d5875b
Security Audit / Python Dependency Audit (push) Has been cancelled
Security Audit / Node.js Dependency Audit (push) Has been cancelled
fix(payouts): 500 in GET /hr/payouts – computed Felder als optional
user_name/created_by_name sind Pflichtfelder, die der Router erst NACH
model_validate(payout) setzt – pydantic v2 schlägt aber schon bei der
Validierung fehl (Feld fehlt am ORM-Objekt). Default "" ergänzt; der
Router überschreibt die Werte wie bisher.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-23 22:35:40 +02:00

34 lines
940 B
Python

import uuid
from datetime import datetime
from decimal import Decimal
from pydantic import BaseModel, Field
class HoursPayoutCreate(BaseModel):
user_id: uuid.UUID
hours: Decimal = Field(gt=0, le=999.99, decimal_places=2)
period_year: int | None = Field(None, ge=2000, le=2100)
period_month: int | None = Field(None, ge=1, le=12)
note: str | None = Field(None, max_length=500)
class HoursPayoutOut(BaseModel):
model_config = {"from_attributes": True}
id: uuid.UUID
company_id: uuid.UUID
user_id: uuid.UUID
user_name: str = "" # Computed: first_name + last_name (wird im Router gesetzt)
hours: Decimal
period_year: int | None
period_month: int | None
note: str | None
created_by: uuid.UUID
created_by_name: str = "" # Computed im Router
created_at: datetime
class HoursPayoutListResponse(BaseModel):
payouts: list[HoursPayoutOut]
total_count: int