cli now uses DI

This commit is contained in:
counterweight 2025-03-07 12:52:15 +01:00
parent b680ede093
commit 9246da2e84
Signed by: counterweight
GPG key ID: 883EDBAA726BD96C
3 changed files with 46 additions and 13 deletions

View file

@ -5,8 +5,21 @@ const invitesService = new InvitesServiceProvider({
nostrService,
}).provide();
module.exports = async function createAppInvite(inviterNpub) {
const appInvite = await invitesService.createAppInvite(inviterNpub);
console.log('Invite created');
console.log(`Check at http://localhost/invite/${appInvite.uuid}`);
};
class CreateAppInviteProvider {
constructor({ nostrService, invitesService }) {
this.nostrService = nostrService;
this.invitesService = invitesService;
}
provide() {
const createAppInvite = async (inviterNpub) => {
const appInvite = await invitesService.createAppInvite(inviterNpub);
console.log('Invite created');
console.log(`Check at http://localhost/invite/${appInvite.uuid}`);
};
return createAppInvite;
}
}
module.exports = CreateAppInviteProvider;