added programa, area ubicacion and programa_equipo
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Body, Controller, Get, Param, Post } from '@nestjs/common';
|
||||
import { Body, Controller, Delete, Get, Param, Post } from '@nestjs/common';
|
||||
import { AlumnoSancionService } from './alumno_sancion.service';
|
||||
import { CreateAlumnoSancionDto } from './dto/create-alumno_sancion.dto';
|
||||
|
||||
@@ -11,14 +11,14 @@ export class AlumnoSancionController {
|
||||
return this.alumnoSancionService.create(createAlumnoSancionDto);
|
||||
}
|
||||
|
||||
@Get()
|
||||
findAll() {
|
||||
return this.alumnoSancionService.findAll();
|
||||
@Get(':id')
|
||||
findbyStudent(@Param('id') id: number) {
|
||||
return this.alumnoSancionService.findbyStudent(+id);
|
||||
}
|
||||
|
||||
@Get(':id')
|
||||
findOne(@Param('id') id: number) {
|
||||
return this.alumnoSancionService.findOne(+id);
|
||||
@Delete()
|
||||
deleteSancion(){
|
||||
|
||||
}
|
||||
}
|
||||
//IO
|
||||
@@ -36,16 +36,25 @@ export class AlumnoSancionService {
|
||||
return await this.alumnosancionRepository.save(alumnosancion);
|
||||
}
|
||||
|
||||
findAll() {
|
||||
return `This action returns all alumnoSancion`;
|
||||
}
|
||||
|
||||
async findOne(id_cuenta: number): Promise<AlumnoSancion> {
|
||||
const alusancion = await this.alumnosancionRepository.findOne({
|
||||
async findbyStudent(id_cuenta: number): Promise<AlumnoSancion[]> {
|
||||
const alusancion = await this.alumnosancionRepository.find({
|
||||
where: { alumno: { id_cuenta } },
|
||||
select:{
|
||||
id_alumno_sancion:true,
|
||||
fecha_inicio:true,
|
||||
alumno:{
|
||||
id_cuenta:true,
|
||||
nombre:true
|
||||
},
|
||||
sancion:{
|
||||
id_sancion:true,
|
||||
sancion:true,
|
||||
duracion:true
|
||||
}
|
||||
}
|
||||
});
|
||||
if (!alusancion) {
|
||||
throw new NotFoundException(`Student with ID ${id_cuenta} not found`);
|
||||
throw new NotFoundException(`student without sancion`);
|
||||
}
|
||||
return alusancion;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user