refactor: tenant models to nestjs

This commit is contained in:
Ahmed Bouhuolia
2025-03-30 21:22:54 +02:00
parent 682be715ae
commit caff6ce47c
13 changed files with 92 additions and 70 deletions

View File

@@ -1,6 +1,6 @@
// @ts-nocheck
import { Knex } from 'knex';
import { Inject } from '@nestjs/common';
import { Inject, Injectable } from '@nestjs/common';
import { EventEmitter2 } from '@nestjs/event-emitter';
import {
IInventoryTransactionsDeletedPayload,
@@ -14,6 +14,7 @@ import { transformItemEntriesToInventory } from '../utils';
import { IItemEntryTransactionType } from '../../TransactionItemEntry/ItemEntry.types';
import { ItemEntry } from '../../TransactionItemEntry/models/ItemEntry';
@Injectable()
export class InventoryTransactionsService {
/**
* @param {EventEmitter2} eventEmitter - Event emitter.
@@ -143,7 +144,7 @@ export class InventoryTransactionsService {
trx?: Knex.Transaction,
): Promise<{ oldInventoryTransactions: InventoryTransaction[] }> {
// Retrieve the inventory transactions of the given sale invoice.
const oldInventoryTransactions = await this.inventoryTransactionModel
const oldInventoryTransactions = await this.inventoryTransactionModel()
.query(trx)
.where({ transactionId, transactionType });