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
239 changes: 119 additions & 120 deletions .claude/skills/opengecko-frontend-design/SKILL.md

Large diffs are not rendered by default.

381 changes: 307 additions & 74 deletions CLAUDE.md

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ COPY . .
# 创建必要目录
RUN mkdir -p /app/uploads /app/data

# 复制并赋予 entrypoint 执行权限(在切换用户前完成)
RUN chmod +x /app/entrypoint.sh

# 创建非 root 用户,降低容器权限
RUN addgroup --system --gid 1001 appgroup \
&& adduser --system --uid 1001 --ingroup appgroup appuser \
Expand All @@ -24,5 +27,7 @@ USER appuser

EXPOSE 8000

# entrypoint 先执行 alembic upgrade head,再启动应用
ENTRYPOINT ["/app/entrypoint.sh"]
# 开发环境使用 uvicorn,生产通过 docker-compose.prod.yml 覆盖为 gunicorn
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"]
592 changes: 592 additions & 0 deletions backend/alembic/versions/002_schema_additions.py

Large diffs are not rendered by default.

27 changes: 0 additions & 27 deletions backend/alembic/versions/002_simplify_roles.py

This file was deleted.

59 changes: 0 additions & 59 deletions backend/alembic/versions/003_add_content_communities.py

This file was deleted.

35 changes: 35 additions & 0 deletions backend/alembic/versions/003_data_migrations.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
"""数据迁移:角色简化 + content_communities 数据回填

合并原 002(简化权限角色)和 003(内容社区关联数据迁移)的数据操作。
对全新安装的数据库这两个操作均为空操作(无行可更新/迁移)。

Revision ID: 003_data_migrations
Revises: 002_schema_additions
Create Date: 2026-02-24
"""

from alembic import op

revision = "003_data_migrations"
down_revision = "002_schema_additions"
branch_labels = None
depends_on = None


def upgrade() -> None:
# 1. 简化权限角色:community_admin 降为 user
op.execute("UPDATE community_users SET role = 'user' WHERE role = 'community_admin'")

# 2. 将 contents.community_id 现有数据回填到 content_communities 关联表
op.execute("""
INSERT INTO content_communities (content_id, community_id, is_primary)
SELECT id, community_id, 1
FROM contents
WHERE community_id IS NOT NULL
""")


def downgrade() -> None:
# 删除回填数据(仅删除 is_primary=1 且来源于迁移的行)
# 注意:角色简化不可逆(无法区分哪些 user 原本是 community_admin)
op.execute("DELETE FROM content_communities WHERE is_primary = 1")
81 changes: 0 additions & 81 deletions backend/alembic/versions/004_add_people_module.py

This file was deleted.

Loading
Loading