2025-09-17 16:35:52 -06:00
|
|
|
import { Controller, Get, Post, Body, Param } from '@nestjs/common';
|
|
|
|
|
import { AlumnoService } from './student.service';
|
2025-09-09 21:19:17 -04:00
|
|
|
import { CreateStudentDto } from './dto/create-student.dto';
|
2025-09-18 16:50:10 -06:00
|
|
|
import { Alumno } from './entities/student.entity';
|
2025-09-09 21:19:17 -04:00
|
|
|
|
|
|
|
|
@Controller('student')
|
|
|
|
|
export class StudentController {
|
2025-09-17 16:35:52 -06:00
|
|
|
constructor(private readonly alumnoService: AlumnoService) {}
|
2025-09-09 21:19:17 -04:00
|
|
|
|
|
|
|
|
@Post()
|
2025-09-18 16:50:10 -06:00
|
|
|
async create(@Body() createStudentDto: CreateStudentDto): Promise<Alumno> {
|
2025-09-17 16:35:52 -06:00
|
|
|
return this.alumnoService.create(createStudentDto);
|
2025-09-09 21:19:17 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Get()
|
2025-09-18 16:50:10 -06:00
|
|
|
async findAll(): Promise<Alumno[]> {
|
2025-09-17 16:35:52 -06:00
|
|
|
return this.alumnoService.findAll();
|
2025-09-09 21:19:17 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Get(':id')
|
2025-09-16 22:37:25 -06:00
|
|
|
findOne(@Param('id') id: number) {
|
2025-09-17 16:35:52 -06:00
|
|
|
return this.alumnoService.findOne(+id);
|
2025-09-09 21:19:17 -04:00
|
|
|
}
|
|
|
|
|
}
|