Refactor validation into validation/

This commit is contained in:
Nitwix
2025-04-12 12:01:02 +02:00
parent e176892dab
commit e96af14f6c
6 changed files with 3 additions and 2 deletions

View File

@ -0,0 +1,35 @@
from typing import Literal, Optional
from pydantic import BaseModel, ConfigDict, EmailStr, Field
class FromDescription(BaseModel):
"""
Fields which can be extracted from description.txt
"""
model_config = ConfigDict(validate_assignment=True, str_strip_whitespace=True)
full_name: str = Field(..., min_length=1)
age: int = Field(..., ge=0, le=120)
nationality: str = Field(..., min_length=1)
marital_status: Literal["single", "married", "divorced", "widowed"]
has_children: bool
secondary_education_school: str
secondary_education_year: int = Field(..., ge=1900, le=2100)
university_name: str
university_graduation_year: int = Field(..., ge=1900, le=2100)
occupation_title: str
employer: str
start_year: int = Field(..., ge=1900, le=2100)
annual_salary_eur: float = Field(..., ge=0)
total_savings_eur: float = Field(..., ge=0)
has_properties: bool
inheritance_amount_eur: float = Field(..., ge=0)
inheritance_year: int = Field(..., ge=1900, le=2100)
inheritance_source: str