You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
957 B
28 lines
957 B
from sqlalchemy import Column, String, DateTime, UUID, ForeignKey, Float, Integer |
|
from sqlalchemy.orm import relationship |
|
from apiApp.database import Base |
|
import uuid |
|
from datetime import datetime |
|
|
|
|
|
class Audio(Base): |
|
__tablename__ = "audio" |
|
|
|
id = Column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4) |
|
filename = Column(String(255), nullable=False) |
|
index_date = Column(DateTime, default=datetime.utcnow) |
|
file_path = Column(String(500)) |
|
duration = Column(Float) |
|
file_size = Column(Integer) |
|
|
|
ai_conclusion = relationship("AiConclusion", back_populates="audio", cascade="all, delete-orphan") |
|
|
|
def to_dict(self): |
|
return { |
|
"id": str(self.id), |
|
"filename": self.filename, |
|
"index_date": self.index_date.isoformat() if self.index_date else None, |
|
"file_path": self.file_path, |
|
"duration": self.duration, |
|
"file_size": self.file_size |
|
} |