Merge branch 'Lino' into Dev
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import {
|
import {
|
||||||
BadRequestException,
|
BadRequestException,
|
||||||
Injectable,
|
Injectable,
|
||||||
|
InternalServerErrorException,
|
||||||
Req,
|
Req,
|
||||||
UseGuards,
|
UseGuards,
|
||||||
} from '@nestjs/common';
|
} from '@nestjs/common';
|
||||||
@@ -38,7 +39,7 @@ export class OperationsService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const user = await this.userService.findOne(id_usuario);
|
const user = await this.userService.findOne(id_usuario);
|
||||||
const alum = await this.alumnoService.findOne(id_cuenta)
|
const alum = await this.alumnoService.findOne(id_cuenta);
|
||||||
|
|
||||||
const detalleData = {
|
const detalleData = {
|
||||||
servicio: 1,
|
servicio: 1,
|
||||||
@@ -63,7 +64,7 @@ export class OperationsService {
|
|||||||
return { message: 'correct' };
|
return { message: 'correct' };
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
await queryRunner.rollbackTransaction();
|
await queryRunner.rollbackTransaction();
|
||||||
return { message: 'error', error: error.message };
|
throw new InternalServerErrorException(error.message);
|
||||||
} finally {
|
} finally {
|
||||||
await queryRunner.release();
|
await queryRunner.release();
|
||||||
}
|
}
|
||||||
@@ -72,6 +73,12 @@ export class OperationsService {
|
|||||||
async addCredit(data, id_usuario: number) {
|
async addCredit(data, id_usuario: number) {
|
||||||
const { id_cuenta, monto, fecha_recibo, folio_recibo } = data;
|
const { id_cuenta, monto, fecha_recibo, folio_recibo } = data;
|
||||||
|
|
||||||
|
const ticket = await this.reciboService.findOne(folio_recibo);
|
||||||
|
|
||||||
|
if (ticket) {
|
||||||
|
throw new BadRequestException('Ticket ya existente');
|
||||||
|
}
|
||||||
|
|
||||||
const queryRunner = this.dataSource.createQueryRunner();
|
const queryRunner = this.dataSource.createQueryRunner();
|
||||||
await queryRunner.connect();
|
await queryRunner.connect();
|
||||||
await queryRunner.startTransaction();
|
await queryRunner.startTransaction();
|
||||||
@@ -96,7 +103,7 @@ export class OperationsService {
|
|||||||
return { message: 'correct' };
|
return { message: 'correct' };
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
await queryRunner.rollbackTransaction();
|
await queryRunner.rollbackTransaction();
|
||||||
return { message: 'error', error: error.message };
|
throw new InternalServerErrorException(error.message);
|
||||||
} finally {
|
} finally {
|
||||||
await queryRunner.release();
|
await queryRunner.release();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user