Files
ai-learning-platform/backend/src/modules/models/models.controller.ts
T

20 lines
556 B
TypeScript

import { Controller, Get, Param, Query } from '@nestjs/common';
import { ApiTags } from '@nestjs/swagger';
import { ModelsService } from './models.service';
@ApiTags('AI 模型')
@Controller('models')
export class ModelsController {
constructor(private modelsService: ModelsService) {}
@Get()
async findAll(@Query('featured') featured?: string) {
return this.modelsService.findAll({ featured: featured === 'true' });
}
@Get(':id')
async findById(@Param('id') id: string) {
return this.modelsService.findById(parseInt(id, 10));
}
}