import { Injectable } from '@nestjs/common'; import { BaseDataService } from 'src/core/modules/data/service/base-data.service'; import { ItemEntity } from '../../domain/entities/item.entity'; import { InjectRepository } from '@nestjs/typeorm'; import { ItemModel } from '../models/item.model'; import { CONNECTION_NAME } from 'src/core/strings/constants/base.constants'; import { Repository } from 'typeorm'; import { ItemRateModel } from 'src/modules/item-related/item-rate/data/models/item-rate.model'; @Injectable() export class ItemDataService extends BaseDataService { constructor( @InjectRepository(ItemModel, CONNECTION_NAME.DEFAULT) private repo: Repository, @InjectRepository(ItemRateModel, CONNECTION_NAME.DEFAULT) private repoItemRate: Repository, ) { super(repo); } async updateItemRatePrice( oldPrice: number, newPrice: number, itemId: string, ): Promise { console.log({ oldPrice, newPrice, itemId }); this.repoItemRate.update( { item_id: itemId, price: oldPrice }, { price: newPrice }, ); } }