create new ep delete programs

This commit is contained in:
2026-02-19 08:33:53 -06:00
parent 6055c6ae76
commit cba8ec6d0e
2 changed files with 13 additions and 3 deletions
+9 -3
View File
@@ -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);
}
}
+4
View File
@@ -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)
}
}