- New canonical model: Proposal, ProposalStatus (app/models/proposal.py)
- New canonical router: /projects/{id}/proposals (app/api/routers/proposals.py)
- Schemas renamed: ProposalCreate, ProposalUpdate, ProposalResponse, etc.
- Old propose.py and proposes.py kept as backward-compat shims
- Legacy /proposes API still works (delegates to /proposals handlers)
- DB table name (proposes), column (propose_code), and permission names
(propose.*) kept unchanged for zero-migration compat
- Updated init_wizard.py comments
35 lines
1.2 KiB
Python
35 lines
1.2 KiB
Python
from sqlalchemy import Column, Integer, String, Text, DateTime, ForeignKey, Enum
|
|
from sqlalchemy.sql import func
|
|
from app.core.config import Base
|
|
import enum
|
|
|
|
|
|
class ProposalStatus(str, enum.Enum):
|
|
OPEN = "open"
|
|
ACCEPTED = "accepted"
|
|
REJECTED = "rejected"
|
|
|
|
|
|
class Proposal(Base):
|
|
__tablename__ = "proposes" # keep DB table name for compat
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
propose_code = Column(String(64), nullable=True, unique=True, index=True) # keep column name for DB compat
|
|
title = Column(String(255), nullable=False)
|
|
description = Column(Text, nullable=True)
|
|
status = Column(Enum(ProposalStatus, values_callable=lambda x: [e.value for e in x]), default=ProposalStatus.OPEN)
|
|
|
|
project_id = Column(Integer, ForeignKey("projects.id"), nullable=False)
|
|
created_by_id = Column(Integer, ForeignKey("users.id"), nullable=True)
|
|
|
|
# Populated server-side after accept; links to the generated feature story task
|
|
feat_task_id = Column(String(64), nullable=True)
|
|
|
|
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
|
updated_at = Column(DateTime(timezone=True), onupdate=func.now())
|
|
|
|
|
|
# Backward-compatible aliases
|
|
ProposeStatus = ProposalStatus
|
|
Propose = Proposal
|