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