28 lines
726 B
Python
28 lines
726 B
Python
|
|
from typing import Optional, Dict, Any
|
|
from uuid import UUID
|
|
from datetime import datetime
|
|
from app.models.ingredient import AssetType
|
|
from pydantic import BaseModel, ConfigDict, Field
|
|
|
|
class IngredientBase(BaseModel):
|
|
name: str
|
|
type: AssetType
|
|
metadata: Optional[Dict[str, Any]] = Field(default={}, validation_alias="metadata_")
|
|
|
|
class IngredientCreate(IngredientBase):
|
|
project_id: UUID
|
|
|
|
class Ingredient(IngredientBase):
|
|
id: UUID
|
|
project_id: UUID
|
|
s3_key: str
|
|
s3_bucket: str
|
|
thumbnail_key: Optional[str] = None
|
|
created_at: datetime
|
|
|
|
# Computed fields or properties can be added here
|
|
presigned_url: Optional[str] = None
|
|
|
|
model_config = ConfigDict(from_attributes=True)
|