2026-05-17 19:08:07 +08:00
|
|
|
import { Controller, Get, Post, Patch, Body, Param, Query } from '@nestjs/common';
|
2026-05-09 18:25:04 +08:00
|
|
|
import { ApiTags, ApiOperation } from '@nestjs/swagger';
|
|
|
|
|
import { FocusItemsService } from './focus-items.service';
|
2026-05-17 00:39:46 +08:00
|
|
|
import { CurrentUser } from '../../common/decorators/current-user.decorator';
|
2026-05-17 19:08:07 +08:00
|
|
|
import { PaginationDto } from '../../common/dto/pagination.dto';
|
2026-05-17 00:39:46 +08:00
|
|
|
import type { UserPayload } from '../../common/types';
|
2026-05-09 18:25:04 +08:00
|
|
|
|
|
|
|
|
@ApiTags('focus-items')
|
|
|
|
|
@Controller('focus-items')
|
|
|
|
|
export class FocusItemsController {
|
|
|
|
|
constructor(private readonly focusItemsService: FocusItemsService) {}
|
|
|
|
|
|
|
|
|
|
@Get()
|
|
|
|
|
@ApiOperation({ summary: '获取待巩固项列表' })
|
2026-05-17 19:08:07 +08:00
|
|
|
async findAll(@CurrentUser() user: UserPayload, @Query() pagination: PaginationDto) {
|
|
|
|
|
return this.focusItemsService.findAll(String(user?.id || 'anonymous'), pagination);
|
2026-05-09 18:25:04 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Post()
|
|
|
|
|
@ApiOperation({ summary: '创建待巩固项' })
|
2026-05-17 00:39:46 +08:00
|
|
|
async create(@CurrentUser() user: UserPayload, @Body() dto: any) {
|
|
|
|
|
return this.focusItemsService.create(String(user?.id || 'anonymous'), dto);
|
2026-05-09 18:25:04 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Patch(':id')
|
|
|
|
|
@ApiOperation({ summary: '更新待巩固项' })
|
|
|
|
|
async update(@Param('id') id: string, @Body() dto: any) {
|
|
|
|
|
return this.focusItemsService.update(id, dto);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Post(':id/complete')
|
|
|
|
|
@ApiOperation({ summary: '完成待巩固项' })
|
|
|
|
|
async complete(@Param('id') id: string) {
|
|
|
|
|
return this.focusItemsService.complete(id);
|
|
|
|
|
}
|
|
|
|
|
}
|