create new ep delete programs
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import { Controller, Get, Post, Body, Patch, Param } from '@nestjs/common';
|
||||
import { Controller, Get, Post, Body, Patch, Param, Delete } from '@nestjs/common';
|
||||
import { ProgramaService } from './programa.service';
|
||||
import { UpdateProgramaDto } from './dto/update-programa.dto';
|
||||
|
||||
@Controller('programa')
|
||||
export class ProgramaController {
|
||||
constructor(private readonly programaService: ProgramaService) {}
|
||||
constructor(private readonly programaService: ProgramaService) { }
|
||||
|
||||
@Get()
|
||||
findAll() {
|
||||
@@ -15,7 +15,8 @@ export class ProgramaController {
|
||||
findOne(@Param('id') id: string) {
|
||||
return this.programaService.findOne(+id);
|
||||
}
|
||||
@Post()
|
||||
|
||||
@Post()
|
||||
create(@Body() body) {
|
||||
return this.programaService.create(body);
|
||||
}
|
||||
@@ -25,4 +26,9 @@ export class ProgramaController {
|
||||
return this.programaService.update(+id, updateProgramaDto);
|
||||
}
|
||||
|
||||
@Delete(':id')
|
||||
delete(@Param('id') id:string){
|
||||
return this.programaService.delete(+id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -35,6 +35,10 @@ export class ProgramaService {
|
||||
await this.programaRepository.update(id, updateProgramaDto);
|
||||
return await this.findOne(id);
|
||||
}
|
||||
|
||||
async delete(id:number){
|
||||
return this.programaRepository.delete(id)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user