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 { ProgramaService } from './programa.service';
|
||||||
import { UpdateProgramaDto } from './dto/update-programa.dto';
|
import { UpdateProgramaDto } from './dto/update-programa.dto';
|
||||||
|
|
||||||
@Controller('programa')
|
@Controller('programa')
|
||||||
export class ProgramaController {
|
export class ProgramaController {
|
||||||
constructor(private readonly programaService: ProgramaService) {}
|
constructor(private readonly programaService: ProgramaService) { }
|
||||||
|
|
||||||
@Get()
|
@Get()
|
||||||
findAll() {
|
findAll() {
|
||||||
@@ -15,7 +15,8 @@ export class ProgramaController {
|
|||||||
findOne(@Param('id') id: string) {
|
findOne(@Param('id') id: string) {
|
||||||
return this.programaService.findOne(+id);
|
return this.programaService.findOne(+id);
|
||||||
}
|
}
|
||||||
@Post()
|
|
||||||
|
@Post()
|
||||||
create(@Body() body) {
|
create(@Body() body) {
|
||||||
return this.programaService.create(body);
|
return this.programaService.create(body);
|
||||||
}
|
}
|
||||||
@@ -25,4 +26,9 @@ export class ProgramaController {
|
|||||||
return this.programaService.update(+id, updateProgramaDto);
|
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);
|
await this.programaRepository.update(id, updateProgramaDto);
|
||||||
return await this.findOne(id);
|
return await this.findOne(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async delete(id:number){
|
||||||
|
return this.programaRepository.delete(id)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user