HSB-439 feature: invite link with SMTP optional (#4078)
* feat: env variable added in infra-config for smtp enable status * feat: event emitter added * feat: added advance mailer configurations from infra config * test: fix test cases * feat: added query to see is smtp enabled or not * feat: email auth provider disabled on smtp disable * chore: restrict on update directly instead of dedicated mutation * fix: feedback resolved * chore: modify mailer module * chore: error handle in mailer functions * chore: removed unused imports * chore: remove event-emit * chore: update env example * test: fix broken test cases * chore: feedback resolved * chore: isSMTPEnabled moved to infra config resolver * fix: email can not reenable if smtp not enabled
This commit is contained in:
@@ -75,6 +75,7 @@ const dbAdminUsers: DbUser[] = [
|
||||
currentRESTSession: '',
|
||||
currentGQLSession: '',
|
||||
lastLoggedOn: new Date(),
|
||||
lastActiveOn: new Date(),
|
||||
createdOn: new Date(),
|
||||
},
|
||||
{
|
||||
@@ -87,6 +88,7 @@ const dbAdminUsers: DbUser[] = [
|
||||
currentRESTSession: '',
|
||||
currentGQLSession: '',
|
||||
lastLoggedOn: new Date(),
|
||||
lastActiveOn: new Date(),
|
||||
createdOn: new Date(),
|
||||
},
|
||||
];
|
||||
|
||||
@@ -359,4 +359,23 @@ export class InfraResolver {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Mutation(() => Boolean, {
|
||||
description: 'Enable or Disable SMTP for sending emails',
|
||||
})
|
||||
@UseGuards(GqlAuthGuard, GqlAdminGuard)
|
||||
async toggleSMTP(
|
||||
@Args({
|
||||
name: 'status',
|
||||
type: () => ServiceStatus,
|
||||
description: 'Toggle SMTP',
|
||||
})
|
||||
status: ServiceStatus,
|
||||
) {
|
||||
const isUpdated = await this.infraConfigService.enableAndDisableSMTP(
|
||||
status,
|
||||
);
|
||||
if (E.isLeft(isUpdated)) throwErr(isUpdated.left);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user