Skip to content

feat: Refactor architecture to be more logical#60

Merged
ZhengZhenyu merged 8 commits intoopensourceways:mainfrom
ZhengZhenyu:main
Feb 22, 2026
Merged

feat: Refactor architecture to be more logical#60
ZhengZhenyu merged 8 commits intoopensourceways:mainfrom
ZhengZhenyu:main

Conversation

@ZhengZhenyu
Copy link
Collaborator

变更说明

e3c64c8 feat: Phase 4b — EventTask 甘特图 API + Issue 同步 + 活动前端
a646e71 feat: Phase 4a — 人脉中台 + 活动管理基础
e3f1f8d feat: 前置重构 2.3 — 前端导航重组
a2d0a51 refactor: 前置重构 2.2 — 内容多社区关联(content_communities)
30bdc45 refactor: 前置重构 2.1 — 权限模型简化(移除 community_admin 角色)

关联 Issue:#

Checklist

  • 功能实现正确,无明显 Bug
  • 测试通过(新增/修改功能已补充测试,覆盖率 ≥ 80%)
  • 无敏感信息硬编码(密钥、密码、Token)
  • 数据库有变更时迁移文件已生成并测试
  • 必要的文档已同步更新

- 新增 Alembic 迁移 002_simplify_roles:将 community_users.role = community_admin 统一降级为 user
- dependencies.py 新增 get_current_admin_or_superuser(检查是否为 superuser 或任意社区 admin)
- 保留 get_community_admin 供过渡期兼容
- committees.py / meetings.py:全员可操作,改为 get_current_user(普通用户也可编辑治理内容)
- communities.py / analytics.py:平台级配置改为 get_current_admin_or_superuser(admin+ 限制)
- 全部 371 个测试通过,无 regression
- 新增 content_communities 关联表及 Alembic 迁移(003)
- Content/Community 模型新增双向 relationship(communities/linked_contents)
- ContentCreate/Update/Out schema 新增 community_ids 字段
- contents API 全面切换为 content_communities 过滤逻辑:
  - _build_community_filter 使用 OR 兼容策略(join表 + legacy community_id 列)
  - _get_content_community_ids / _write_content_communities 帮助函数
  - 所有路由返回 community_ids 字段
- 保留 contents.community_id 列供过渡期使用(migration 009 后移除)
- 侧边栏按新信息架构重组:
  社区工作台 / 个人工作看板 / 社区治理 / 内容管理 /
  活动管理 / 洞察与人脉 / 平台管理
- 发布管理并入内容管理子菜单
- 平台管理(社区设置 + 超管专属)整合为统一分组
- 新增占位路由与视图:/events、/people、/campaigns
  (Phase 4a/4c 功能完成后逐步填充)
- 我的工作改名为"个人工作看板"
模型层:
- models/people.py:PersonProfile + CommunityRole
- models/event.py:EventTemplate、ChecklistTemplateItem、Event、
  ChecklistItem、EventPersonnel、EventAttendee、FeedbackItem、IssueLink、EventTask
- models/committee.py:CommitteeMember 新增 person_id → PersonProfile 关联

迁移:
- 004_add_people_module:person_profiles + community_roles
- 005_add_event_module:9 张活动相关表
- 006_link_committee_member_to_person:batch_alter_table 兼容 SQLite

服务层:
- services/people_service.py:find_or_suggest 去重匹配算法

API 层(schemas + routers):
- api/people.py:人脉 CRUD + 角色管理 + 批量导入 + 确认合并
- api/events.py:活动 CRUD + Checklist + 人员安排 + 签到导入 + 反馈 + Issue 关联
- api/event_templates.py:SOP 模板 CRUD

main.py 注册新路由(/api/people、/api/events、/api/event-templates)
后端:
- EventTask CRUD 路由(GET/POST/PATCH/DELETE /events/{id}/tasks,批量重排序)
- 任务树形结构组装(_build_task_tree)
- services/issue_sync.py:每日定时同步 GitHub Issue 状态
- APScheduler BackgroundScheduler 注册在 lifespan(避免测试事件循环冲突)
- requirements.txt 追加 apscheduler==3.10.4

前端:
- Events.vue:活动列表页(卡片网格 + 筛选 + 创建弹窗)
- EventDetail.vue:活动详情页(清单/人员/任务甘特图/反馈四个 Tab)
- api/event.ts:完整 API 模块(Event/Checklist/Personnel/Feedback/Task)
- router 追加 /events/:id → EventDetail 路由
- package.json 追加 frappe-gantt 依赖

测试:371 passed, 3 skipped
@opensourceways-bot
Copy link
Contributor

Linking Issue Notice

@ZhengZhenyu , the pull request must be linked to at least one issue.
If an issue has already been linked, but the needs-issue label remains, you can remove the label by commenting /check-issue .

@opensourceways-bot
Copy link
Contributor

CLA Signature Guide

@ZhengZhenyu , thanks for your pull request.

The following commit(s) are not associated with a signed Contributor License Agreement (CLA).

Commit Reason
30bdc45a refactor: 前置重构 2.1 — �... the email used in the commit is not linked to a signed CLA!
please verify that it matches the email you used when signing the CLA.

To sign CLA, click here.

To check if your email is configured correctly, refer to the FAQs.

Once you've signed the CLA or updating your email, please comment /check-cla to revalidate CLA status.

@opensourceways-bot
Copy link
Contributor

CLA Signature Guide

@ZhengZhenyu , thanks for your pull request.

The following commit(s) are not associated with a signed Contributor License Agreement (CLA).

Commit Reason
30bdc45a refactor: 前置重构 2.1 — �... the email used in the commit is not linked to a signed CLA!
please verify that it matches the email you used when signing the CLA.

To sign CLA, click here.

To check if your email is configured correctly, refer to the FAQs.

Once you've signed the CLA or updating your email, please comment /check-cla to revalidate CLA status.

- migration 006: batch_alter_table 中 FK 约束需显式命名,改用 create_foreign_key()
- frontend: 新增 src/types/frappe-gantt.d.ts 解决 vue-tsc TS2307 类型错误
@opensourceways-bot
Copy link
Contributor

CLA Signature Guide

@ZhengZhenyu , thanks for your pull request.

The following commit(s) are not associated with a signed Contributor License Agreement (CLA).

Commit Reason
30bdc45a refactor: 前置重构 2.1 — �... the email used in the commit is not linked to a signed CLA!
please verify that it matches the email you used when signing the CLA.

To sign CLA, click here.

To check if your email is configured correctly, refer to the FAQs.

Once you've signed the CLA or updating your email, please comment /check-cla to revalidate CLA status.

@opensourceways-bot
Copy link
Contributor

CLA Signature Guide

@ZhengZhenyu , thanks for your pull request.

The following commit(s) are not associated with a signed Contributor License Agreement (CLA).

Commit Reason
30bdc45a refactor: 前置重构 2.1 — �... the email used in the commit is not linked to a signed CLA!
please verify that it matches the email you used when signing the CLA.

To sign CLA, click here.

To check if your email is configured correctly, refer to the FAQs.

Once you've signed the CLA or updating your email, please comment /check-cla to revalidate CLA status.

@ZhengZhenyu ZhengZhenyu merged commit 8155137 into opensourceways:main Feb 22, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants