- AppModule 注册 3 个 BullMQ Workers (AiAnalysis/DocumentImport/Notification) - Users 模块新增 GET/PATCH /users/me/profile 端点: - GET 读取 UserProfile (learningIdentity, learningDirection, bio, currentGoal) - PATCH upsert UserProfile - GET /users/me 返回 profile + preferences (include join) - 新增 RolesGuard + @Roles() 装饰器 (UserRole enum) - QueueModule/QueueService 改进 - 各模块 controller/repository/service 完善 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
27 lines
723 B
TypeScript
27 lines
723 B
TypeScript
import { Injectable, NotFoundException } from '@nestjs/common';
|
|
import { FocusItemsRepository } from './focus-items.repository';
|
|
|
|
@Injectable()
|
|
export class FocusItemsService {
|
|
constructor(private readonly repository: FocusItemsRepository) {}
|
|
|
|
async findAll(userId: string, pagination?: { page?: number; limit?: number }) {
|
|
return this.repository.findAll(userId, pagination);
|
|
}
|
|
|
|
async create(userId: string, dto: any) {
|
|
return this.repository.create({ userId, ...dto });
|
|
}
|
|
|
|
async update(id: string, dto: any) {
|
|
return this.repository.update(id, dto);
|
|
}
|
|
|
|
async complete(id: string) {
|
|
return this.repository.update(id, {
|
|
status: 'completed',
|
|
completedAt: new Date(),
|
|
});
|
|
}
|
|
}
|