get table by number acount
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { Injectable, NotFoundException } from '@nestjs/common';
|
||||
import { CreateBitacoraMesaDto } from './dto/create-bitacora_mesa.dto';
|
||||
import { InjectRepository } from '@nestjs/typeorm';
|
||||
import { BitacoraMesa } from './entities/bitacora_mesa.entity';
|
||||
@@ -15,10 +15,39 @@ export class BitacoraMesaService {
|
||||
}
|
||||
|
||||
findAll() {
|
||||
return this.bitacoraMesaRepository.find({relations:['mesa','alumno_inscrito'],take:100});
|
||||
return this.bitacoraMesaRepository.find({
|
||||
relations: ['mesa', 'alumno_inscrito'],
|
||||
take: 100,
|
||||
});
|
||||
}
|
||||
|
||||
findOne(id: number) {
|
||||
return `This action returns a #${id} bitacoraMesa`;
|
||||
}
|
||||
|
||||
async findByCuenta(id_cuenta: number) {
|
||||
const alumno = await this.bitacoraMesaRepository.findOne({
|
||||
where: {
|
||||
alumno_inscrito: {
|
||||
alumno: {
|
||||
id_cuenta: id_cuenta,
|
||||
},
|
||||
},
|
||||
},
|
||||
relations: {
|
||||
alumno_inscrito: {
|
||||
alumno: true,
|
||||
},
|
||||
mesa: true,
|
||||
},
|
||||
order: {
|
||||
tiempo_entrada: 'DESC',
|
||||
},
|
||||
});
|
||||
if (!alumno) {
|
||||
throw new NotFoundException('alumno sin mesa');
|
||||
}
|
||||
|
||||
return alumno;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user