import { Controller , Inject } from '@nestjs/common' ; import { Connection , Repository } from 'typeorm' ; @ Controller ( ) export class DatabaseService { constructor ( @ Inject ( 'Connection' ) public connection ) { } async getRepository < T > ( entity ) { return this . connection . getRepository ( entity ) ; } }