Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions backend/alembic/versions/011_add_meeting_online_url.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"""为 meetings 表添加 online_url 字段,支持线上线下混合会议

Revision ID: 011_add_meeting_online_url
Revises: 010_make_community_id_nullable
Create Date: 2026-02-23
"""
import sqlalchemy as sa
from alembic import op

revision = "011_add_meeting_online_url"
down_revision = "010_make_community_id_nullable"
branch_labels = None
depends_on = None


def upgrade() -> None:
with op.batch_alter_table("meetings") as batch_op:
batch_op.add_column(
sa.Column("online_url", sa.String(500), nullable=True)
)


def downgrade() -> None:
with op.batch_alter_table("meetings") as batch_op:
batch_op.drop_column("online_url")
2 changes: 1 addition & 1 deletion backend/app/api/contents.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def create_content(
if data.source_type not in VALID_SOURCE_TYPES:
raise HTTPException(400, f"Invalid source_type, must be one of {VALID_SOURCE_TYPES}")
content_html = convert_markdown_to_html(data.content_markdown) if data.content_markdown else ""
# 主社区:优先取 community_ids[0],兼容旧逻辑
# 主社区: community_ids[0];若未提供则不关联社区
primary_community_id = data.community_ids[0] if data.community_ids else None
content = Content(
title=data.title,
Expand Down
2 changes: 2 additions & 0 deletions backend/app/api/meetings.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ def create_meeting(
duration=data.duration,
location_type=data.location_type,
location=data.location,
online_url=data.online_url,
agenda=data.agenda,
status="scheduled",
work_status="planning", # 固定默认值,不对外暴露
Expand Down Expand Up @@ -163,6 +164,7 @@ def get_meeting(
"duration": meeting.duration,
"location_type": meeting.location_type,
"location": meeting.location,
"online_url": meeting.online_url,
"status": meeting.status,
"work_status": meeting.work_status,
"agenda": meeting.agenda,
Expand Down
5 changes: 2 additions & 3 deletions backend/app/api/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from sqlalchemy.orm import Session

from app.config import settings
from app.core.dependencies import get_current_community, get_current_user
from app.core.dependencies import get_current_user
from app.database import get_db
from app.models.content import Content
from app.models.user import User
Expand All @@ -23,7 +23,6 @@ async def upload_file(
file: UploadFile = File(...),
db: Session = Depends(get_db),
current_user: User = Depends(get_current_user),
current_community: int = Depends(get_current_community),
):
if not file.filename:
raise HTTPException(400, "No filename provided")
Expand Down Expand Up @@ -60,7 +59,7 @@ async def upload_file(
source_type="contribution",
source_file=save_name,
status="draft",
community_id=current_community,
community_id=None,
created_by_user_id=current_user.id,
)
db.add(content)
Expand Down
3 changes: 2 additions & 1 deletion backend/app/models/meeting.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ class Meeting(Base):
duration = Column(Integer, default=120) # 持续时长(分钟)

location_type = Column(String(50), nullable=True) # online / offline / hybrid
location = Column(String(500), nullable=True)
location = Column(String(500), nullable=True) # 线下会议地址
online_url = Column(String(500), nullable=True) # 线上会议链接(online / hybrid 时使用)

status = Column(String(50), default="scheduled", index=True)
# 可选值: scheduled, in_progress, completed, cancelled
Expand Down
4 changes: 3 additions & 1 deletion backend/app/schemas/content.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ContentCreate(BaseModel):
scheduled_publish_at: datetime | None = None
work_status: str = "planning"
assignee_ids: list[int] = []
# 多社区关联:不填则默认使用 X-Community-Id header 对应的社区
# 多社区关联:不填则内容不关联任何社区
community_ids: list[int] = []


Expand Down Expand Up @@ -73,6 +73,8 @@ class ContentListOut(BaseModel):
tags: list[str]
category: str
status: str
work_status: str = "planning"
community_id: int | None = None
owner_id: int | None = None
scheduled_publish_at: datetime | None = None
created_at: datetime
Expand Down
7 changes: 5 additions & 2 deletions backend/app/schemas/governance.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ class MeetingCreate(BaseModel):
scheduled_at: datetime
duration: int = Field(120, ge=1)
location_type: str | None = "online"
location: str | None = None
location: str | None = None # 线下会议地址(offline / hybrid)
online_url: str | None = None # 线上会议链接(online / hybrid)
agenda: str | None = None
reminder_before_hours: int = 24
assignee_ids: list[int] = []
Expand All @@ -140,7 +141,8 @@ class MeetingUpdate(BaseModel):
scheduled_at: datetime | None = None
duration: int | None = Field(None, ge=1)
location_type: str | None = None
location: str | None = None
location: str | None = None # 线下会议地址(offline / hybrid)
online_url: str | None = None # 线上会议链接(online / hybrid)
status: str | None = None
agenda: str | None = None
reminder_before_hours: int | None = None
Expand All @@ -157,6 +159,7 @@ class MeetingOut(BaseModel):
duration: int
location_type: str | None = None
location: str | None = None
online_url: str | None = None
status: str
reminder_sent: bool
created_by_user_id: int | None = None
Expand Down
Loading
Loading