Open zellkon opened 3 years ago
you have to directly access the repository from the service. One way to do so is to make your repository public inside your service class, then access it from your other service like so:
@Injectable()
export class ApplicationsService extends TypeOrmCrudService<Application> {
constructor(
@InjectRepository(Application)
public readonly repo: Repository<Application>, // make the repository public
) {
super(repo)
}
}
and from another service, you can use it this way:
await this.applicationsService.repo.update(app.id, app) // access the repository directly
you have to directly access the repository from the service. One way to do so is to make your repository public inside your service class, then access it from your other service like so:
@Injectable() export class ApplicationsService extends TypeOrmCrudService<Application> { constructor( @InjectRepository(Application) public readonly repo: Repository<Application>, // make the repository public ) { super(repo) } }
and from another service, you can use it this way:
await this.applicationsService.repo.update(app.id, app) // access the repository directly
finally a solution for most of my problems!! ❤️
you have to directly access the repository from the service. One way to do so is to make your repository public inside your service class, then access it from your other service like so:
@Injectable() export class ApplicationsService extends TypeOrmCrudService<Application> { constructor( @InjectRepository(Application) public readonly repo: Repository<Application>, // make the repository public ) { super(repo) } }
and from another service, you can use it this way:
await this.applicationsService.repo.update(app.id, app) // access the repository directly
I never comment on GitHub but this saved my life, thank you so much 🎉
I kept using
await this.applicationsService.getOne(req)
And mess around trying to make it work by modifying what's inside the req and kept thinking that this was dumb, now it all makes sense, still wondering why this is not indicated at all in the documentation ?
Here my code, im using userService.CreateOne for create new user from Auth.Service
please help me! Thank All!