import { Injectable } from '@nestjs/common' ; import { InjectRepository } from '@nestjs/typeorm' ; import { Type } from './type.entity' ; import { Repository } from 'typeorm' ; import { CreateTypeDto } from './dto/create-type_dto' ; @ Injectable ( ) export class TypeService { constructor ( @ InjectRepository ( Type ) private readonly typeRepository ) { } async findAll ( ) { const data = await this . typeRepository . find ( { relations : [ 'details' ] , } ) ; return data . filter ( item => item . status === 1 ) ; } async findOne ( id ) { return await this . typeRepository . findOne ( { relations : [ 'details' ] , where : { id } , } ) ; } }