I want to create a service that receives an entity and creates a repository
this is my trials:
export class MyService<T extends ObjectLiteral> {
protected repo: Repository<T>;
constructor(entity: T) {
let token = getRepositoryToken(entity);
this.repo = InjectRepository(entity)(this, 'repo');
}
// methods
}
usage:
let service = new MyService(MyEntity)
service.repo.findmany()