API для работы с файлами, индексация файлов и результатов распощнавания
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user