BE-PR-001: Rename Propose -> Proposal across backend
- 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
This commit is contained in:
@@ -264,32 +264,32 @@ class MilestoneResponse(MilestoneBase):
|
||||
from_attributes = True
|
||||
|
||||
|
||||
# Propose schemas
|
||||
# Proposal schemas (renamed from Propose)
|
||||
|
||||
class ProposeStatusEnum(str, Enum):
|
||||
class ProposalStatusEnum(str, Enum):
|
||||
OPEN = "open"
|
||||
ACCEPTED = "accepted"
|
||||
REJECTED = "rejected"
|
||||
|
||||
|
||||
class ProposeBase(BaseModel):
|
||||
class ProposalBase(BaseModel):
|
||||
title: str
|
||||
description: Optional[str] = None
|
||||
|
||||
|
||||
class ProposeCreate(ProposeBase):
|
||||
class ProposalCreate(ProposalBase):
|
||||
project_id: Optional[int] = None
|
||||
|
||||
|
||||
class ProposeUpdate(BaseModel):
|
||||
class ProposalUpdate(BaseModel):
|
||||
title: Optional[str] = None
|
||||
description: Optional[str] = None
|
||||
|
||||
|
||||
class ProposeResponse(ProposeBase):
|
||||
class ProposalResponse(ProposalBase):
|
||||
id: int
|
||||
propose_code: Optional[str] = None
|
||||
status: ProposeStatusEnum
|
||||
propose_code: Optional[str] = None # DB column name kept for compat
|
||||
status: ProposalStatusEnum
|
||||
project_id: int
|
||||
created_by_id: Optional[int] = None
|
||||
created_by_username: Optional[str] = None
|
||||
@@ -301,6 +301,14 @@ class ProposeResponse(ProposeBase):
|
||||
from_attributes = True
|
||||
|
||||
|
||||
# Backward-compatible aliases
|
||||
ProposeStatusEnum = ProposalStatusEnum
|
||||
ProposeBase = ProposalBase
|
||||
ProposeCreate = ProposalCreate
|
||||
ProposeUpdate = ProposalUpdate
|
||||
ProposeResponse = ProposalResponse
|
||||
|
||||
|
||||
# Paginated response
|
||||
from typing import Generic, TypeVar
|
||||
T = TypeVar("T")
|
||||
|
||||
Reference in New Issue
Block a user