Creacion de entities y servicios
This commit is contained in:
@@ -1,30 +1,24 @@
|
||||
import {
|
||||
Controller,
|
||||
Get,
|
||||
Post,
|
||||
Body,
|
||||
Param,
|
||||
} from '@nestjs/common';
|
||||
import { StudentService } from './student.service';
|
||||
import { Controller, Get, Post, Body, Param } from '@nestjs/common';
|
||||
import { AlumnoService } from './student.service';
|
||||
import { CreateStudentDto } from './dto/create-student.dto';
|
||||
import { Student } from './entities/student.entity';
|
||||
|
||||
@Controller('student')
|
||||
export class StudentController {
|
||||
constructor(private readonly studentService: StudentService) {}
|
||||
constructor(private readonly alumnoService: AlumnoService) {}
|
||||
|
||||
@Post()
|
||||
async create(@Body() createStudentDto: CreateStudentDto): Promise<Student> {
|
||||
return this.studentService.create(createStudentDto);
|
||||
return this.alumnoService.create(createStudentDto);
|
||||
}
|
||||
|
||||
@Get()
|
||||
async findAll(): Promise<Student[]> {
|
||||
return this.studentService.findAll();
|
||||
return this.alumnoService.findAll();
|
||||
}
|
||||
|
||||
@Get(':id')
|
||||
findOne(@Param('id') id: number) {
|
||||
return this.studentService.findOne(+id);
|
||||
return this.alumnoService.findOne(+id);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user