22 lines
827 B
Python
22 lines
827 B
Python
from sqlalchemy import Column, String, DateTime, Text
|
|
from datetime import datetime
|
|
import uuid
|
|
from ..core.database import Base
|
|
|
|
class FileStatus(str):
|
|
NOT_STARTED = "not_started"
|
|
PROCESSING = "processing"
|
|
SUCCESS = "success"
|
|
FAILED = "failed"
|
|
|
|
class File(Base):
|
|
__tablename__ = "files"
|
|
|
|
id = Column(String(36), primary_key=True, default=lambda: str(uuid.uuid4()))
|
|
filename = Column(String(255), nullable=False)
|
|
original_path = Column(String(255), nullable=False)
|
|
processed_path = Column(String(255))
|
|
status = Column(String(20), nullable=False, default=FileStatus.NOT_STARTED)
|
|
error_message = Column(Text)
|
|
created_at = Column(DateTime, nullable=False, default=datetime.utcnow)
|
|
updated_at = Column(DateTime, nullable=False, default=datetime.utcnow, onupdate=datetime.utcnow) |