I am trying to write custom Inject decorator, so I can have access to instance of service that is being injected and pass my data there somehow. But can't reach any success. I am not sure if this is right direction and may be there are better ways to implement this idea
e.g I have Service
@Injectable()
class S3Service {
public getBucket(){
console.log(this.bucket);
}
}
class MyOtherService{
constructor(
@InjectWithParams({bucket: 'fooBucket'})
private readonly customS3Service: S3Service
){
this. customS3Service.getBucket() // may log fooBucket
}
}
class MyOtherOtherService{
constructor(
@InjectWithParams({bucket: 'barBucket'})
private readonly customS3Service: S3Service
){
this. customS3Service.getBucket() // may log barBucket
}
}
I tried few options, like (In Nest.js, how to get a service instance inside a decorator?), but I still can't access service instance in decorator