39 lines
1.1 KiB
Python
39 lines
1.1 KiB
Python
"""Client model - represents a company/organization using LetsBe."""
|
|
|
|
from typing import TYPE_CHECKING, Optional
|
|
|
|
from sqlalchemy import String
|
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
|
|
|
from app.models.base import Base, TimestampMixin, UUIDMixin
|
|
|
|
if TYPE_CHECKING:
|
|
from app.models.instance import Instance
|
|
|
|
|
|
class Client(UUIDMixin, TimestampMixin, Base):
|
|
"""
|
|
A client is a company or organization using LetsBe.
|
|
|
|
Clients can have multiple instances (orchestrator deployments).
|
|
"""
|
|
|
|
__tablename__ = "clients"
|
|
|
|
# Client identification
|
|
name: Mapped[str] = mapped_column(String(255), nullable=False)
|
|
contact_email: Mapped[Optional[str]] = mapped_column(String(255), nullable=True)
|
|
|
|
# Billing/plan info (for future use)
|
|
billing_plan: Mapped[str] = mapped_column(String(50), default="free")
|
|
|
|
# Status
|
|
status: Mapped[str] = mapped_column(String(50), default="active")
|
|
# "active", "suspended", "archived"
|
|
|
|
# Relationships
|
|
instances: Mapped[list["Instance"]] = relationship(
|
|
back_populates="client",
|
|
cascade="all, delete-orphan",
|
|
)
|