23 lines
887 B
Python
23 lines
887 B
Python
from datetime import datetime
|
|
from uuid import uuid4
|
|
|
|
from sqlalchemy import DateTime, ForeignKey, String
|
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
|
|
|
from app.core.database import Base
|
|
|
|
|
|
class UploadedImage(Base):
|
|
__tablename__ = "uploaded_images"
|
|
|
|
id: Mapped[str] = mapped_column(String(36), primary_key=True, default=lambda: str(uuid4()))
|
|
user_id: Mapped[str] = mapped_column(String(36), ForeignKey("users.id"), index=True)
|
|
storage_key: Mapped[str] = mapped_column(String(512))
|
|
original_filename: Mapped[str] = mapped_column(String(255))
|
|
content_type: Mapped[str] = mapped_column(String(80))
|
|
size_bytes: Mapped[int]
|
|
expires_at: Mapped[datetime] = mapped_column(DateTime, index=True)
|
|
created_at: Mapped[datetime] = mapped_column(DateTime, default=datetime.utcnow)
|
|
|
|
reports = relationship("PalmReport", back_populates="image")
|