feat(01-02): create base model and enums
- Add Base class using SQLAlchemy 2.0 DeclarativeBase - Add DiscussionType enum (OPEN, DISCUSS) - Add DiscussionStatus enum (ACTIVE, COMPLETED) - Add RoundType enum (PARALLEL, SEQUENTIAL) - Use str-based enums for database portability
This commit is contained in:
parent
3e90f9cf21
commit
61da27c7d5
1 changed files with 40 additions and 0 deletions
40
src/moai/core/models.py
Normal file
40
src/moai/core/models.py
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
"""SQLAlchemy models for MoAI multi-AI discussion platform.
|
||||||
|
|
||||||
|
Data model hierarchy:
|
||||||
|
Project (has many) → Discussion (has many) → Round (has many) → Message
|
||||||
|
↘ Discussion (has one) → Consensus
|
||||||
|
|
||||||
|
All IDs use UUID stored as String(36) for SQLite compatibility.
|
||||||
|
Enums are stored as strings for database portability.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from enum import Enum
|
||||||
|
|
||||||
|
from sqlalchemy.orm import DeclarativeBase
|
||||||
|
|
||||||
|
|
||||||
|
class Base(DeclarativeBase):
|
||||||
|
"""Base class for all SQLAlchemy models."""
|
||||||
|
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class DiscussionType(str, Enum):
|
||||||
|
"""Type of discussion mode."""
|
||||||
|
|
||||||
|
OPEN = "open"
|
||||||
|
DISCUSS = "discuss"
|
||||||
|
|
||||||
|
|
||||||
|
class DiscussionStatus(str, Enum):
|
||||||
|
"""Status of a discussion."""
|
||||||
|
|
||||||
|
ACTIVE = "active"
|
||||||
|
COMPLETED = "completed"
|
||||||
|
|
||||||
|
|
||||||
|
class RoundType(str, Enum):
|
||||||
|
"""Type of round in a discussion."""
|
||||||
|
|
||||||
|
PARALLEL = "parallel"
|
||||||
|
SEQUENTIAL = "sequential"
|
||||||
Loading…
Add table
Reference in a new issue