M3: console.log -> Logger + UI redesign (QuestionBank) + S7/A9/A10/A11/U11 bug fixes + #1/#2/#3/#4 enhancements + i18n for QuestionBank pages
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import {
|
||||
Injectable,
|
||||
Logger,
|
||||
NotFoundException,
|
||||
ForbiddenException,
|
||||
Inject,
|
||||
@@ -47,6 +48,8 @@ export interface PaginatedGroups {
|
||||
|
||||
@Injectable()
|
||||
export class KnowledgeGroupService {
|
||||
private readonly logger = new Logger(KnowledgeGroupService.name);
|
||||
|
||||
constructor(
|
||||
@InjectRepository(KnowledgeGroup)
|
||||
private groupRepository: Repository<KnowledgeGroup>,
|
||||
@@ -62,7 +65,7 @@ export class KnowledgeGroupService {
|
||||
userId: string,
|
||||
tenantId: string,
|
||||
): Promise<GroupWithFileCount[]> {
|
||||
console.log('[KnowledgeGroup findAll] userId:', userId, 'tenantId:', tenantId);
|
||||
this.logger.log('[KnowledgeGroup findAll] userId: ' + userId + ', tenantId: ' + tenantId);
|
||||
// Return all groups for the tenant with file counts
|
||||
const queryBuilder = this.groupRepository
|
||||
.createQueryBuilder('group')
|
||||
@@ -147,7 +150,7 @@ export class KnowledgeGroupService {
|
||||
tenantId: string,
|
||||
createGroupDto: CreateGroupDto,
|
||||
): Promise<KnowledgeGroup> {
|
||||
console.log('[KnowledgeGroup create] userId:', userId, 'tenantId:', tenantId);
|
||||
this.logger.log('[KnowledgeGroup create] userId: ' + userId + ', tenantId: ' + tenantId);
|
||||
const group = this.groupRepository.create({
|
||||
...createGroupDto,
|
||||
parentId: createGroupDto.parentId ?? null,
|
||||
@@ -155,7 +158,7 @@ export class KnowledgeGroupService {
|
||||
});
|
||||
|
||||
const saved = await this.groupRepository.save(group);
|
||||
console.log('[KnowledgeGroup create] saved group tenantId:', saved.tenantId);
|
||||
this.logger.log('[KnowledgeGroup create] saved group tenantId: ' + saved.tenantId);
|
||||
return saved;
|
||||
}
|
||||
|
||||
@@ -229,7 +232,7 @@ export class KnowledgeGroupService {
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(
|
||||
this.logger.error(
|
||||
`Failed to delete file ${file.id} when deleting group ${id}`,
|
||||
error,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user