added concelation
This commit is contained in:
@@ -9,7 +9,7 @@ import { Repository } from 'typeorm';
|
||||
export class BitacoraService {
|
||||
constructor(
|
||||
@InjectRepository(Bitacora)
|
||||
private readonly bitacoraService: Repository<Bitacora>,
|
||||
private readonly bitacoraRepository: Repository<Bitacora>,
|
||||
) {}
|
||||
create(createBitacoraDto: CreateBitacoraDto) {
|
||||
return 'This action adds a new bitacora';
|
||||
@@ -20,7 +20,7 @@ export class BitacoraService {
|
||||
}
|
||||
|
||||
async findOneByAcount(id_cuenta: number) {
|
||||
const student = await this.bitacoraService
|
||||
const student = await this.bitacoraRepository
|
||||
.createQueryBuilder('bitacora')
|
||||
.leftJoinAndSelect('bitacora.alumno_inscrito', 'alumnoInscrito')
|
||||
.leftJoinAndSelect('alumnoInscrito.alumno', 'alumno')
|
||||
@@ -42,7 +42,7 @@ export class BitacoraService {
|
||||
}
|
||||
|
||||
async findOneByMachine(ubicacion: number) {
|
||||
const student = await this.bitacoraService
|
||||
const student = await this.bitacoraRepository
|
||||
.createQueryBuilder('bitacora')
|
||||
.leftJoinAndSelect('bitacora.alumno_inscrito', 'alumnoInscrito')
|
||||
.leftJoinAndSelect('alumnoInscrito.alumno', 'alumno')
|
||||
@@ -63,4 +63,20 @@ export class BitacoraService {
|
||||
|
||||
return student;
|
||||
}
|
||||
|
||||
async cancelation(id_bitacora: number, nuevoTiempo: number) {
|
||||
const bitacora = await this.bitacoraRepository.findOne({
|
||||
where: { id_bitacora },
|
||||
});
|
||||
|
||||
if (!bitacora) {
|
||||
throw new NotFoundException('alumno sin equipo asignado');
|
||||
}
|
||||
|
||||
bitacora.tiempo_asignado -= nuevoTiempo;
|
||||
|
||||
await this.bitacoraRepository.save(bitacora);
|
||||
|
||||
return { message: 'Tiempo cancelado' };
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user