restore create
This commit is contained in:
@@ -10,10 +10,10 @@ import { AlumnoInscrito } from './entities/alumno_inscrito.entity';
|
|||||||
export class AlumnoInscritoController {
|
export class AlumnoInscritoController {
|
||||||
constructor(private readonly alumnoInscritoService: AlumnoInscritoService) {}
|
constructor(private readonly alumnoInscritoService: AlumnoInscritoService) {}
|
||||||
|
|
||||||
// @Post()
|
@Post()
|
||||||
// async create(@Body() dto: CreateAlumnoInscritoDto): Promise<AlumnoInscrito> {
|
async create(@Body() dto: CreateAlumnoInscritoDto): Promise<AlumnoInscrito> {
|
||||||
// return this.alumnoInscritoService.create(dto);
|
return this.alumnoInscritoService.createWhitoutPay(dto);
|
||||||
// }
|
}
|
||||||
|
|
||||||
@Get()
|
@Get()
|
||||||
async findAll(): Promise<AlumnoInscrito[]> {
|
async findAll(): Promise<AlumnoInscrito[]> {
|
||||||
|
|||||||
@@ -19,33 +19,34 @@ export class AlumnoInscritoService {
|
|||||||
private readonly periodoService: PeriodoService,
|
private readonly periodoService: PeriodoService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
//Borrar
|
async createWhitoutPay(
|
||||||
// async createBorrar(dto: CreateAlumnoInscritoDto): Promise<AlumnoInscrito> {
|
dto: CreateAlumnoInscritoDto,
|
||||||
// const periodoActivo = await this.periodoService.getPeriodoActivo();
|
): Promise<AlumnoInscrito> {
|
||||||
|
const periodoActivo = await this.periodoService.getPeriodoActivo();
|
||||||
|
|
||||||
// const existing = await this.alumnoInscritoRepo.findOne({
|
const existing = await this.alumnoInscritoRepo.findOne({
|
||||||
// where: {
|
where: {
|
||||||
// alumno: { id_cuenta: dto.id_cuenta },
|
alumno: { id_cuenta: dto.id_cuenta },
|
||||||
// periodo: { id_periodo: periodoActivo.id_periodo },
|
periodo: { id_periodo: periodoActivo.id_periodo },
|
||||||
// plataforma: { id_plataforma: dto.id_plataforma },
|
plataforma: { id_plataforma: dto.id_plataforma },
|
||||||
// },
|
},
|
||||||
// });
|
});
|
||||||
|
|
||||||
// if (existing) {
|
if (existing) {
|
||||||
// throw new BadRequestException(
|
throw new BadRequestException(
|
||||||
// 'El alumno ya está inscrito en este periodo y plataforma',
|
'El alumno ya está inscrito en este periodo y plataforma',
|
||||||
// );
|
);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// const alumnoInscrito = this.alumnoInscritoRepo.create({
|
const alumnoInscrito = this.alumnoInscritoRepo.create({
|
||||||
// realizo_pago: dto.realizo_pago ?? false,
|
realizo_pago: dto.realizo_pago ?? false,
|
||||||
// alumno: { id_cuenta: dto.id_cuenta },
|
alumno: { id_cuenta: dto.id_cuenta },
|
||||||
// plataforma: { id_plataforma: dto.id_plataforma },
|
plataforma: { id_plataforma: dto.id_plataforma },
|
||||||
// periodo: periodoActivo,
|
periodo: periodoActivo,
|
||||||
// });
|
});
|
||||||
|
|
||||||
// return this.alumnoInscritoRepo.save(alumnoInscrito);
|
return this.alumnoInscritoRepo.save(alumnoInscrito);
|
||||||
// }
|
}
|
||||||
|
|
||||||
async findAll(): Promise<AlumnoInscrito[]> {
|
async findAll(): Promise<AlumnoInscrito[]> {
|
||||||
return this.alumnoInscritoRepo.find({
|
return this.alumnoInscritoRepo.find({
|
||||||
@@ -58,8 +59,8 @@ export class AlumnoInscritoService {
|
|||||||
return this.plataformaRepo.find();
|
return this.plataformaRepo.find();
|
||||||
}
|
}
|
||||||
|
|
||||||
async findPlataformaById(id_plataforma:number) {
|
async findPlataformaById(id_plataforma: number) {
|
||||||
return this.plataformaRepo.findOne({where:{id_plataforma}});
|
return this.plataformaRepo.findOne({ where: { id_plataforma } });
|
||||||
}
|
}
|
||||||
|
|
||||||
async findById(id_cuenta: number): Promise<AlumnoInscrito[]> {
|
async findById(id_cuenta: number): Promise<AlumnoInscrito[]> {
|
||||||
|
|||||||
Reference in New Issue
Block a user