Auto-assign as project option (default off)
Some checks failed
Deploy Tracker / deploy (push) Failing after 3s
Some checks failed
Deploy Tracker / deploy (push) Failing after 3s
- Project.auto_assign boolean field (default False)
- create_task only auto-assigns if project.auto_assign=True
- PATCH /projects/{id} accepts auto_assign
- ProjectOut includes auto_assign
This commit is contained in:
parent
93cdd38b96
commit
502b55b5a9
@ -29,6 +29,7 @@ class ProjectUpdate(BaseModel):
|
||||
description: str | None = None
|
||||
repo_urls: list[str] | None = None
|
||||
status: str | None = None
|
||||
auto_assign: bool | None = None
|
||||
|
||||
|
||||
class ProjectMemberAdd(BaseModel):
|
||||
@ -70,6 +71,7 @@ async def _project_out(p: Project, db: AsyncSession) -> ProjectOut:
|
||||
status=p.status,
|
||||
task_counter=p.task_counter,
|
||||
chat_id=str(chat.id) if chat else None,
|
||||
auto_assign=p.auto_assign,
|
||||
)
|
||||
|
||||
|
||||
@ -126,6 +128,8 @@ async def update_project(project_id: str, req: ProjectUpdate, db: AsyncSession =
|
||||
project.repo_urls = req.repo_urls
|
||||
if req.status is not None:
|
||||
project.status = req.status
|
||||
if req.auto_assign is not None:
|
||||
project.auto_assign = req.auto_assign
|
||||
|
||||
await db.commit()
|
||||
return await _project_out(project, db)
|
||||
|
||||
@ -102,6 +102,7 @@ class ProjectOut(BaseModel):
|
||||
status: str
|
||||
task_counter: int
|
||||
chat_id: str | None = None
|
||||
auto_assign: bool = False
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
@ -282,8 +282,8 @@ async def create_task(
|
||||
db.add(task)
|
||||
await db.flush()
|
||||
|
||||
# Auto-assign by capabilities if no assignee set
|
||||
if not assignee_id and req.labels:
|
||||
# Auto-assign by capabilities if enabled and no assignee set
|
||||
if not assignee_id and req.labels and project.auto_assign:
|
||||
from ..models import AgentConfig, ProjectMember
|
||||
agents_q = await db.execute(
|
||||
select(Member, AgentConfig)
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
import uuid
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from sqlalchemy import ForeignKey, Integer, String, Text, UniqueConstraint
|
||||
from sqlalchemy import Boolean, ForeignKey, Integer, String, Text, UniqueConstraint
|
||||
from sqlalchemy.dialects.postgresql import ARRAY, UUID
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
|
||||
@ -25,6 +25,7 @@ class Project(Base):
|
||||
repo_urls: Mapped[list[str]] = mapped_column(ARRAY(String), default=list)
|
||||
status: Mapped[str] = mapped_column(String(20), default=ProjectStatus.ACTIVE) # active | archived
|
||||
task_counter: Mapped[int] = mapped_column(Integer, default=0) # for sequential task numbers
|
||||
auto_assign: Mapped[bool] = mapped_column(Boolean, default=False) # auto-assign tasks by labels ↔ capabilities
|
||||
|
||||
tasks: Mapped[list["Task"]] = relationship(back_populates="project", cascade="all, delete-orphan")
|
||||
chats: Mapped[list["Chat"]] = relationship(back_populates="project", cascade="all, delete-orphan")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user