import { Injectable } from '@nestjs/common'; import { SalesPriceFormulaEntity } from '../../domain/entities/sales-price-formula.entity'; import { InjectRepository } from '@nestjs/typeorm'; import { SalesPriceFormulaModel, TransactionSettingModel, } from '../models/sales-price-formula.model'; import { CONNECTION_NAME } from 'src/core/strings/constants/base.constants'; import { Repository } from 'typeorm'; import { BaseReadService } from 'src/core/modules/data/service/base-read.service'; @Injectable() export class SalesPriceFormulaReadService extends BaseReadService { constructor( @InjectRepository(SalesPriceFormulaModel, CONNECTION_NAME.DEFAULT) private repo: Repository, @InjectRepository(TransactionSettingModel, CONNECTION_NAME.DEFAULT) private transactionSetting: Repository, ) { super(repo); } async getTransactionSetting(): Promise { try { const data = await this.transactionSetting.findOne({ where: {}, order: { created_at: 'DESC', }, }); return data; } catch (error) { throw error; } } }