Spaces:
Sleeping
Sleeping
| from datetime import datetime | |
| from typing import Optional | |
| from pydantic import BaseModel, Field | |
| class Alert(BaseModel): | |
| """MongoDB Alert model.""" | |
| id: Optional[str] = Field(default=None, alias="_id") | |
| user_id: str # Reference to user | |
| type: str # water, fertilize, pest, health | |
| title: str | |
| description: str | |
| plantName: str | |
| plantId: str # Reference to plant | |
| priority: str # urgent, high, medium, low | |
| timestamp: str # ISO datetime string | |
| isRead: bool = False | |
| created_at: datetime = Field(default_factory=datetime.utcnow) | |
| class Config: | |
| populate_by_name = True | |