Initial commit: VoIdeaAI - voice-first AI idea assistant

This commit is contained in:
2026-05-13 12:51:42 +03:00
commit 688d043dad
421 changed files with 47915 additions and 0 deletions
+69
View File
@@ -0,0 +1,69 @@
"""Tariff models for VoIdea."""
from datetime import datetime
from decimal import Decimal
from typing import Any, Optional
from sqlalchemy import Boolean, ForeignKey, Numeric, String, Text
from sqlalchemy.dialects.postgresql import JSONB, UUID
from sqlalchemy.orm import Mapped, mapped_column
from app.core.base import SQLBase, TimestampMixin, UUIDMixin
class TariffPlan(SQLBase, UUIDMixin, TimestampMixin):
__tablename__ = "tariff_plans"
name: Mapped[str] = mapped_column(
String(100), nullable=False
)
code: Mapped[str] = mapped_column(
String(50), unique=True, nullable=False, index=True
)
description: Mapped[Optional[str]] = mapped_column(
Text, nullable=True
)
price_monthly: Mapped[Decimal] = mapped_column(
Numeric(10, 2), default=0, nullable=False
)
price_yearly: Mapped[Optional[Decimal]] = mapped_column(
Numeric(10, 2), nullable=True
)
features: Mapped[Optional[dict[str, Any]]] = mapped_column(
JSONB, nullable=True, default=None
)
is_active: Mapped[bool] = mapped_column(
Boolean, default=True, nullable=False
)
sort_order: Mapped[int] = mapped_column(
default=0, nullable=False
)
class UserSubscription(SQLBase, UUIDMixin, TimestampMixin):
__tablename__ = "user_subscriptions"
user_id: Mapped[UUID] = mapped_column(
UUID(as_uuid=True),
ForeignKey("users.id", ondelete="CASCADE"),
unique=True,
nullable=False,
index=True,
)
plan_id: Mapped[UUID] = mapped_column(
UUID(as_uuid=True),
ForeignKey("tariff_plans.id", ondelete="RESTRICT"),
nullable=False,
)
status: Mapped[str] = mapped_column(
String(20), default="active", nullable=False, index=True
)
current_period_start: Mapped[Optional[datetime]] = mapped_column(
nullable=True
)
current_period_end: Mapped[Optional[datetime]] = mapped_column(
nullable=True
)
canceled_at: Mapped[Optional[datetime]] = mapped_column(
nullable=True
)