Initial commit: VoIdeaAI - voice-first AI idea assistant
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
"""Idea model for VoIdea."""
|
||||
|
||||
from typing import Optional
|
||||
|
||||
from sqlalchemy import Boolean, ForeignKey, String, Text
|
||||
from sqlalchemy.dialects.postgresql import ARRAY, UUID
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
|
||||
from app.core.base import SQLBase, TimestampMixin, UUIDMixin
|
||||
|
||||
|
||||
class Idea(SQLBase, UUIDMixin, TimestampMixin):
|
||||
__tablename__ = "ideas"
|
||||
|
||||
user_id: Mapped[UUID] = mapped_column(
|
||||
UUID(as_uuid=True),
|
||||
ForeignKey("users.id", ondelete="CASCADE"),
|
||||
nullable=False,
|
||||
index=True,
|
||||
)
|
||||
title: Mapped[str] = mapped_column(
|
||||
String(255), nullable=False, index=True
|
||||
)
|
||||
content: Mapped[str] = mapped_column(
|
||||
Text, nullable=False
|
||||
)
|
||||
status: Mapped[str] = mapped_column(
|
||||
String(20), default="draft", nullable=False, index=True
|
||||
)
|
||||
tags: Mapped[Optional[list[str]]] = mapped_column(
|
||||
ARRAY(String(50)), nullable=True
|
||||
)
|
||||
is_public: Mapped[bool] = mapped_column(
|
||||
Boolean, default=False, nullable=False
|
||||
)
|
||||
public_slug: Mapped[Optional[str]] = mapped_column(
|
||||
String(64), unique=True, nullable=True, index=True
|
||||
)
|
||||
|
||||
user = relationship("User", back_populates="ideas", lazy="selectin")
|
||||
Reference in New Issue
Block a user