Merge branch 'development' of ssh://git.eigen.co.id:2222/eigen/pos-be into feat/data-trx-schedule
commit
cfb863b7d0
|
@ -111,6 +111,7 @@ export class CouchService {
|
||||||
const selector = {
|
const selector = {
|
||||||
created_at: {
|
created_at: {
|
||||||
$gte: todayTimestamp,
|
$gte: todayTimestamp,
|
||||||
|
status: 'settled',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,10 @@ import {
|
||||||
SalesPriceFormulaModel,
|
SalesPriceFormulaModel,
|
||||||
TransactionSettingModel,
|
TransactionSettingModel,
|
||||||
} from '../models/sales-price-formula.model';
|
} from '../models/sales-price-formula.model';
|
||||||
import { CONNECTION_NAME } from 'src/core/strings/constants/base.constants';
|
import {
|
||||||
|
CONNECTION_NAME,
|
||||||
|
STATUS,
|
||||||
|
} from 'src/core/strings/constants/base.constants';
|
||||||
import { Repository } from 'typeorm';
|
import { Repository } from 'typeorm';
|
||||||
import { FormulaType } from '../../constants';
|
import { FormulaType } from '../../constants';
|
||||||
import { TaxModel } from 'src/modules/transaction/tax/data/models/tax.model';
|
import { TaxModel } from 'src/modules/transaction/tax/data/models/tax.model';
|
||||||
|
@ -75,6 +78,7 @@ export class SalesPriceFormulaDataService extends BaseDataService<SalesPriceForm
|
||||||
.where('transaction.created_at > :timestamp', {
|
.where('transaction.created_at > :timestamp', {
|
||||||
timestamp: todayTimestamp,
|
timestamp: todayTimestamp,
|
||||||
})
|
})
|
||||||
|
.andWhere('transaction.status = :status', { status: STATUS.SETTLED })
|
||||||
.andWhere('transaction.type = :type', { type: TransactionType.COUNTER })
|
.andWhere('transaction.type = :type', { type: TransactionType.COUNTER })
|
||||||
.getRawOne()
|
.getRawOne()
|
||||||
.then((result) => result.sum || 0),
|
.then((result) => result.sum || 0),
|
||||||
|
|
|
@ -19,6 +19,7 @@ import {
|
||||||
TransactionCreateQueueEvent,
|
TransactionCreateQueueEvent,
|
||||||
} from '../../entities/event/transaction-change-status.event';
|
} from '../../entities/event/transaction-change-status.event';
|
||||||
import { PriceCalculator } from '../calculator/price.calculator';
|
import { PriceCalculator } from '../calculator/price.calculator';
|
||||||
|
import { Logger } from '@nestjs/common';
|
||||||
|
|
||||||
@EventsHandler(ChangeDocEvent)
|
@EventsHandler(ChangeDocEvent)
|
||||||
export class PosTransactionHandler implements IEventHandler<ChangeDocEvent> {
|
export class PosTransactionHandler implements IEventHandler<ChangeDocEvent> {
|
||||||
|
@ -41,6 +42,7 @@ export class PosTransactionHandler implements IEventHandler<ChangeDocEvent> {
|
||||||
try {
|
try {
|
||||||
const database = event.data.database;
|
const database = event.data.database;
|
||||||
const data = { ...event.data.data };
|
const data = { ...event.data.data };
|
||||||
|
Logger.log(`receipt data with code ${data?.code}`);
|
||||||
|
|
||||||
// jika bukan database transaksi, return langsung
|
// jika bukan database transaksi, return langsung
|
||||||
if (database != 'transaction') return;
|
if (database != 'transaction') return;
|
||||||
|
|
Loading…
Reference in New Issue