Files
AIclinicalresearch/backend/src/modules/admin/system-kb/systemKbRoutes.ts
HaHafeng 0b29fe88b5 feat(iit): QC deep fix + V3.1 architecture plan + project member management
QC System Deep Fix:
- HardRuleEngine: add null tolerance + field availability pre-check (skipped status)
- SkillRunner: baseline data merge for follow-up events + field availability check
- QcReportService: record-level pass rate calculation + accurate LLM XML report
- iitBatchController: legacy log cleanup (eventId=null) + upsert RecordSummary
- seed-iit-qc-rules: null/empty string tolerance + applicableEvents config

V3.1 Architecture Design (docs only, no code changes):
- QC engine V3.1 plan: 5-level data structure (CDISC ODM) + D1-D7 dimensions
- Three-batch implementation strategy (A: foundation, B: bubbling, C: new engines)
- Architecture team review: 4 whitepapers reviewed + feedback doc + 4 critical suggestions
- CRA Agent strategy roadmap + CRA 4-tool explanation doc for clinical experts

Project Member Management:
- Cross-tenant member search and assignment (remove tenant restriction)
- IIT project detail page enhancement with tabbed layout (KB + members)
- IitProjectContext for business-side project selection
- System-KB route access control adjustment for project operators

Frontend:
- AdminLayout sidebar menu restructure
- IitLayout with project context provider
- IitMemberManagePage new component
- Business-side pages adapt to project context

Prisma:
- 2 new migrations (user-project RBAC + is_demo flag)
- Schema updates for project member management

Made-with: Cursor
2026-03-01 15:27:05 +08:00

76 lines
1.7 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* 系统知识库路由
*
* 路由前缀:/api/v1/admin/system-kb
*/
import { FastifyInstance } from 'fastify';
import {
listKnowledgeBases,
getKnowledgeBase,
createKnowledgeBase,
updateKnowledgeBase,
deleteKnowledgeBase,
listDocuments,
uploadDocument,
deleteDocument,
downloadDocument,
} from './systemKbController.js';
import { authenticate, requireRoles } from '../../../common/auth/auth.middleware.js';
export async function systemKbRoutes(fastify: FastifyInstance) {
// 认证 + 角色守卫SUPER_ADMIN / ADMIN / IIT_OPERATOR 均可完整操作知识库
const preHandler = [authenticate, requireRoles('SUPER_ADMIN', 'ADMIN', 'IIT_OPERATOR')];
// ==================== 知识库 CRUD ====================
// 获取知识库列表
fastify.get('/', {
preHandler,
}, listKnowledgeBases as any);
// 创建知识库
fastify.post('/', {
preHandler,
}, createKnowledgeBase as any);
// 获取知识库详情
fastify.get('/:id', {
preHandler,
}, getKnowledgeBase as any);
// 更新知识库
fastify.patch('/:id', {
preHandler,
}, updateKnowledgeBase as any);
// 删除知识库
fastify.delete('/:id', {
preHandler,
}, deleteKnowledgeBase as any);
// ==================== 文档管理 ====================
// 获取文档列表
fastify.get('/:id/documents', {
preHandler,
}, listDocuments as any);
// 上传文档
fastify.post('/:id/documents', {
preHandler,
}, uploadDocument as any);
// 删除文档
fastify.delete('/:id/documents/:docId', {
preHandler,
}, deleteDocument as any);
// 下载文档(获取签名 URL
fastify.get('/:id/documents/:docId/download', {
preHandler,
}, downloadDocument as any);
}
export default systemKbRoutes;