Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /mundobien2025_fastapi-basekit /tests /example_crud_beanie /models.py
| """Modelos Beanie (MongoDB) para pruebas.""" | |
| from datetime import datetime | |
| from typing import Optional | |
| from beanie import Document | |
| from pydantic import Field | |
| class UserDocument(Document): | |
| """Modelo de usuario para MongoDB con Beanie.""" | |
| name: str = Field(..., min_length=1, max_length=100) | |
| email: str = Field(..., min_length=1, max_length=100) | |
| age: Optional[int] = Field(None, ge=0, le=150) | |
| is_active: bool = True | |
| created_at: datetime = Field(default_factory=datetime.utcnow) | |
| updated_at: datetime = Field(default_factory=datetime.utcnow) | |
| deleted_at: Optional[datetime] = None | |
| class Settings: | |
| name = "users" # Collection name | |
| indexes = [ | |
| "email", # Index on email | |
| ] | |
| class Config: | |
| json_schema_extra = { | |
| "example": { | |
| "name": "John Doe", | |
| "email": "john@example.com", | |
| "age": 30, | |
| "is_active": True, | |
| } | |
| } | |
| def __repr__(self): | |
| return f"<UserDocument(id={self.id}, name='{self.name}', email='{self.email}')>" | |
Xet Storage Details
- Size:
- 1.1 kB
- Xet hash:
- 9dbe4346e929e63514fe3c56ef901ae2ccb94c7effd31a01ec99494e73faa77d
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.