Repository navigation
release: 合并三项社区贡献(App 分页修复 / 循环外键 / 跨方言 JSONType) - #546
Merged
Merged
Conversation
sys_user.dept_id 与 sys_dept(UserMixin 审计字段)互为外键形成循环依赖。原 dept_id 用 use_alter=True 规避,但 use_alter 在 Alembic autogenerate 下会被内联进 op.create_table,PostgreSQL 编译时跳过导致外键静默丢失。 移除 created_id/updated_id/deleted_id 三个审计字段指向 sys_user 的外键约束(ondelete=SET NULL 已允许悬空,审计字段无需强引用),并为 created_by/updated_by/deleted_by 关系显式补充 primaryjoin。循环依赖消除后,dept_id 的 use_alter 亦可移除,autogenerate 可正确生成迁移。
根因:后端 PageResultSchema 统一返回 items 字段,但 App 端 PageResult 类型与 useListPage 等消费点硬编码读取 list,导致工单评论、AI 会话、首页公告等既有列表页数据恒为空。 影响面:工单详情评论分页、AI 助手会话列表、首页公告,以及所有复用 useListPage 的通用列表页(工单列表、公告列表等)。 修复: - global.d.ts 的 PageResult<T> 字段 list → items,与后端对齐 - useListPage.ts 的 data 提取器改读 items - ticket-detail / chat / 首页 index 三处消费点 res.list → res.items
fix: 修复 App 分页字段 list/items 不一致导致列表恒空
refactor: 去除 UserMixin 审计字段外键约束以消除循环外键
原 PR #543 的实现,因其与 #541 同改 base_model.py 的 import 行产生冲突,此处为基于最新 dev 的 rebase 版本,改动内容与原提交一致(提交作者保留为 Echo-Note)。 - PostgreSQL:JSONB;SQLite / MySQL:通用 JSON(TypeEngine.with_variant) - 验证:三方言 DDL(JSONB / JSON / JSON)、sqlite create_all 建表 + JSON 读写、 ruff / basedpyright 0 errors / pytest 97 passed 关联 issue #542:本 PR 提供统一入口;生成器 jsonb 映射与方言类型 import 的修复留作后续。
feat: 新增跨方言 JSON 类型 JSONType(rebase 版,替代 #543 的冲突)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
内容(3 个已验证的社区贡献)
list→items55fadae7PageResultSchema只返回items,App 4 处消费点读list导致列表恒空;类型定义同步修正UserMixin审计外键(消除循环外键)45a8ade9sys_dept/sys_user循环外键消除;created_by/updated_by/deleted_by改显式primaryjoin(pairs 正确、selectinload可执行)JSONTypeae7ed651(PR #545,替代冲突的 #543)JSONB,SQLite/MySQL →JSON验证(本地实跑,dev 头部
ae7ed651)ruff check:All checks passedbasedpyright:0 errors, 0 warningspytest:97 passedfrontend/appvue-tsc --noEmit:exit 0审核过程中的发现(已记录在 issue)
jsonb渲染成from sqlalchemy import JSONB(非法 import,实测AttributeError),需后续 PR 修复生成器映射