Last active
March 9, 2018 12:58
-
-
Save Razzwan/3f4ea9113b254837761f68c884007118 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// One more service, which do nothisn except create new instance with userId field | |
class oneSignalService { | |
async create(user, data) { | |
return this.repository.create<UserOneSignal>({ | |
userId: user.id, | |
...data, | |
}); | |
} | |
} | |
@Component() | |
export class MeService { | |
constructor( | |
// must be injected one more service here, | |
private readonly oneSignalService: OneSignalService, | |
) {} | |
async someMethod(user, data) { | |
// We should ignore the availability of the ready-made method within the library used, but use your exact same method | |
await this.oneSignalService.create<UserOneSignal>(user, data); | |
} | |
async reusageInSecondPlace(user, data) { | |
// We should ignore the availability of the ready-made method within the library used, but use your exact same method | |
await this.oneSignalService.create<UserOneSignal>(user, data); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment