fix(SPG-1027): Total QR not same with total ticket
parent
c0a68db9f1
commit
8d54c686fc
|
@ -2,7 +2,7 @@ import { Injectable } from '@nestjs/common';
|
|||
import { BaseDataService } from 'src/core/modules/data/service/base-data.service';
|
||||
import { InjectRepository } from '@nestjs/typeorm';
|
||||
import { CONNECTION_NAME } from 'src/core/strings/constants/base.constants';
|
||||
import { Between, In, Repository } from 'typeorm';
|
||||
import { Between, In, IsNull, Not, Repository } from 'typeorm';
|
||||
import { QueueTicket } from '../../domain/entities/ticket.entity';
|
||||
import {
|
||||
QueueItemModel,
|
||||
|
@ -34,7 +34,21 @@ export class TicketDataService extends BaseDataService<QueueTicket> {
|
|||
async loginQueue(id: string): Promise<QueueOrder> {
|
||||
return this.order.findOneOrFail({
|
||||
relations: ['tickets'],
|
||||
where: [{ transaction_id: id }, { code: id }],
|
||||
where: [
|
||||
{ transaction_id: id },
|
||||
{ code: id, transaction_id: Not(IsNull()) },
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
async ticketByCode(code: string): Promise<QueueTicketModel[]> {
|
||||
return this.repo.find({
|
||||
relations: ['order'],
|
||||
where: {
|
||||
order: {
|
||||
code,
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,10 @@ export class QueueOrchestrator {
|
|||
|
||||
async loginCustomer(id: string): Promise<QueueOrder> {
|
||||
try {
|
||||
return await this.dataService.loginQueue(id);
|
||||
const order = await this.dataService.loginQueue(id);
|
||||
const tickets = await this.dataService.ticketByCode(order.code);
|
||||
order.tickets = tickets;
|
||||
return order;
|
||||
} catch (error) {
|
||||
throw new UnauthorizedException({
|
||||
message: 'Invoice tidak ditemukan',
|
||||
|
|
Loading…
Reference in New Issue