All checks were successful
Deploy API Server / build-and-deploy (push) Successful in 1m0s
- AI: 新三层架构 Provider→Gateway→Workflow(15文件,DeepSeek+MiniMax) - Auth: 全局JwtAuthGuard + @Public()装饰器白名单路由 - DB: 12个Repository从Map/Array迁到Prisma - Schema: 新增AiUsageLog、WaitlistEntry模型 - API: /api-docs-json加Basic Auth保护 - 清理: 删除infrastructure/ai、docs/旧文档 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
29 lines
923 B
TypeScript
29 lines
923 B
TypeScript
import { Injectable, NotFoundException } from '@nestjs/common';
|
|
import { ReviewRepository } from './review.repository';
|
|
import { SubmitReviewDto } from './dto/submit-review.dto';
|
|
|
|
@Injectable()
|
|
export class ReviewService {
|
|
constructor(private readonly reviewRepository: ReviewRepository) {}
|
|
|
|
async getDueCards(userId: string) {
|
|
return this.reviewRepository.findDueCards(userId);
|
|
}
|
|
|
|
async submitReview(userId: string, id: string, dto: SubmitReviewDto) {
|
|
const card = await this.reviewRepository.findById(id);
|
|
if (!card) throw new NotFoundException(`Review card ${id} not found`);
|
|
const log = await this.reviewRepository.insertLog({
|
|
userId,
|
|
reviewCardId: id,
|
|
rating: dto.rating,
|
|
responseText: dto.responseText,
|
|
});
|
|
await this.reviewRepository.updateCard(id, {
|
|
status: 'reviewed',
|
|
nextReviewAt: new Date(Date.now() + 86400000),
|
|
});
|
|
return log;
|
|
}
|
|
}
|