refactor(data): 收口关系表运行时数据源
Some checks failed
Deploy Production / Build, push, deploy, verify (push) Has been cancelled
Some checks failed
Deploy Production / Build, push, deploy, verify (push) Has been cancelled
- 移除已迁移业务 AppData 运行时 fallback,改走领域 API 和关系表快读 - 补齐需求产品负责人、版本计划任务 JSON 和成员 username 回填迁移 - 统一治理字典入口,并补充 AI provider、数据源契约和领域服务测试 Co-Authored-By: Codex GPT-5 <codex@openai.com>
This commit is contained in:
@@ -15,7 +15,7 @@ export interface SelectWorkspaceCollectionsInput {
|
||||
v22Loaded: boolean;
|
||||
v22Failed: boolean;
|
||||
v22Data: V22WorkspaceData | null;
|
||||
appData: {
|
||||
storeData: {
|
||||
plans: VersionPlan[];
|
||||
devTasks: DevTask[];
|
||||
testCases: TestCase[];
|
||||
@@ -27,21 +27,46 @@ export function selectWorkspaceCollections({
|
||||
v22Loaded,
|
||||
v22Failed,
|
||||
v22Data,
|
||||
appData,
|
||||
storeData,
|
||||
}: SelectWorkspaceCollectionsInput): WorkspaceCollections {
|
||||
if (v22Loaded && !v22Failed && v22Data) {
|
||||
const hasV22Rows = v22Data.versionPlans.length > 0
|
||||
|| v22Data.devTasks.length > 0
|
||||
|| v22Data.testCases.length > 0
|
||||
|| v22Data.bugs.length > 0;
|
||||
if (!hasV22Rows) {
|
||||
return {
|
||||
versionPlans: v22Data.versionPlans,
|
||||
devTasks: v22Data.devTasks,
|
||||
testCases: v22Data.testCases,
|
||||
bugs: v22Data.bugs,
|
||||
};
|
||||
}
|
||||
return {
|
||||
versionPlans: v22Data.versionPlans,
|
||||
devTasks: v22Data.devTasks,
|
||||
testCases: v22Data.testCases,
|
||||
bugs: v22Data.bugs,
|
||||
versionPlans: overlayRowsById(v22Data.versionPlans, storeData.plans),
|
||||
devTasks: overlayRowsById(v22Data.devTasks, storeData.devTasks),
|
||||
testCases: overlayRowsById(v22Data.testCases, storeData.testCases),
|
||||
bugs: overlayRowsById(v22Data.bugs, storeData.bugs),
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
versionPlans: appData.plans,
|
||||
devTasks: appData.devTasks,
|
||||
testCases: appData.testCases,
|
||||
bugs: appData.bugs,
|
||||
versionPlans: storeData.plans,
|
||||
devTasks: storeData.devTasks,
|
||||
testCases: storeData.testCases,
|
||||
bugs: storeData.bugs,
|
||||
};
|
||||
}
|
||||
|
||||
function overlayRowsById<T extends { id: string }>(baseRows: T[], overlayRows: T[]): T[] {
|
||||
const overlayById = new Map(overlayRows.map((item) => [item.id, item]));
|
||||
const seen = new Set<string>();
|
||||
const merged = baseRows.map((item) => {
|
||||
seen.add(item.id);
|
||||
return overlayById.get(item.id) ?? item;
|
||||
});
|
||||
for (const item of overlayRows) {
|
||||
if (!seen.has(item.id)) merged.push(item);
|
||||
}
|
||||
return merged;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user