33 lines
1.2 KiB
TypeScript
33 lines
1.2 KiB
TypeScript
import { Controller, Get, Post, Body, Query } from '@nestjs/common';
|
|
import { ProgressService } from './progress.service';
|
|
|
|
@Controller('progress')
|
|
export class ProgressController {
|
|
constructor(private readonly service: ProgressService) {}
|
|
|
|
@Get('stats')
|
|
getStats(@Query('session') session: string) {
|
|
return this.service.getStats(session || 'default');
|
|
}
|
|
|
|
@Post('word')
|
|
recordWord(@Body() body: { session_id: string; word_id: number }) {
|
|
return this.service.recordWordStudied(body.session_id, body.word_id);
|
|
}
|
|
|
|
@Post('quiz-answer')
|
|
recordAnswer(@Body() body: { session_id: string; word_id: number; is_correct: boolean; word?: { english: string; korean: string } }) {
|
|
return this.service.recordQuizAnswer(body.session_id, body.word_id, body.is_correct, body.word);
|
|
}
|
|
|
|
@Post('quiz-complete')
|
|
recordComplete(@Body() body: { session_id: string; score: number; total: number }) {
|
|
return this.service.recordQuizComplete(body.session_id, body.score, body.total);
|
|
}
|
|
|
|
@Get('studied-words')
|
|
getStudiedWords(@Query('session') session: string, @Query('date') date?: string) {
|
|
return this.service.getStudiedWordIds(session || 'default', date);
|
|
}
|
|
}
|