Initial commit: AuraK人才测评系统基础框架
## 已实现功能 - 题库管理后端API完整实现 - 模板管理页面(Settings-测评模板) - 评估统计页面 - 人才测评页面(AssessmentView) - QuestionBank前端服务层 ## 技术栈 - 后端: Node.js + NestJS + TypeORM - 前端: React + TypeScript - 容器化: Docker Compose ## 已知待完善 - 题库列表页缺少删除按钮 - 题库详情页未实现(题目管理/AI生成/审核)
This commit is contained in:
@@ -43,6 +43,7 @@ export class KnowledgeGroupController {
|
||||
@Post()
|
||||
@Roles(UserRole.TENANT_ADMIN, UserRole.SUPER_ADMIN)
|
||||
async create(@Body() createGroupDto: CreateGroupDto, @Request() req) {
|
||||
console.log('[KnowledgeGroup] create called, user:', req.user);
|
||||
return await this.groupService.create(
|
||||
req.user.id,
|
||||
req.user.tenantId,
|
||||
|
||||
@@ -62,11 +62,19 @@ export class KnowledgeGroupService {
|
||||
userId: string,
|
||||
tenantId: string,
|
||||
): Promise<GroupWithFileCount[]> {
|
||||
console.log('[KnowledgeGroup findAll] userId:', userId, 'tenantId:', tenantId);
|
||||
// Return all groups for the tenant with file counts
|
||||
const groups = await this.groupRepository
|
||||
const queryBuilder = this.groupRepository
|
||||
.createQueryBuilder('group')
|
||||
.leftJoin('group.knowledgeBases', 'kb')
|
||||
.where('group.tenantId = :tenantId', { tenantId })
|
||||
.leftJoin('group.knowledgeBases', 'kb');
|
||||
|
||||
if (tenantId === null) {
|
||||
queryBuilder.where('group.tenantId IS NULL');
|
||||
} else {
|
||||
queryBuilder.where('group.tenantId = :tenantId', { tenantId });
|
||||
}
|
||||
|
||||
const groups = await queryBuilder
|
||||
.addSelect('COUNT(kb.id)', 'fileCount')
|
||||
.groupBy('group.id')
|
||||
.orderBy('group.createdAt', 'ASC')
|
||||
@@ -139,13 +147,16 @@ export class KnowledgeGroupService {
|
||||
tenantId: string,
|
||||
createGroupDto: CreateGroupDto,
|
||||
): Promise<KnowledgeGroup> {
|
||||
console.log('[KnowledgeGroup create] userId:', userId, 'tenantId:', tenantId);
|
||||
const group = this.groupRepository.create({
|
||||
...createGroupDto,
|
||||
parentId: createGroupDto.parentId ?? null,
|
||||
tenantId,
|
||||
});
|
||||
|
||||
return await this.groupRepository.save(group);
|
||||
const saved = await this.groupRepository.save(group);
|
||||
console.log('[KnowledgeGroup create] saved group tenantId:', saved.tenantId);
|
||||
return saved;
|
||||
}
|
||||
|
||||
async update(
|
||||
|
||||
Reference in New Issue
Block a user