Spaces:
Runtime error
Runtime error
| from pydantic import BaseModel, Field | |
| from typing import Optional, List | |
| from datetime import datetime | |
| class Transaction(BaseModel): | |
| id: Optional[int] = None | |
| app_name: str | |
| title: str | |
| text: str | |
| amount: float | |
| merchant: str | |
| category: str = "Uncategorized" | |
| type: str # "Income" or "Expense" | |
| timestamp: int = Field(default_factory=lambda: int(datetime.now().timestamp())) | |
| class Config: | |
| schema_extra = { | |
| "example": { | |
| "id": 1, | |
| "app_name": "Google Pay", | |
| "title": "Payment to Swiggy", | |
| "text": "Paid ₹450.00 to Swiggy", | |
| "amount": 450.0, | |
| "merchant": "Swiggy", | |
| "category": "Food & Dining", | |
| "type": "Expense", | |
| "timestamp": 1623897600 | |
| } | |
| } |