feat: added query to see is smtp enabled or not

This commit is contained in:
mirarifhasan
2024-05-23 15:10:46 +06:00
parent c371b56a23
commit bcaed7ec69
2 changed files with 18 additions and 0 deletions

View File

@@ -292,6 +292,14 @@ export class InfraResolver {
return this.infraConfigService.getAllowedAuthProviders();
}
@Query(() => Boolean, {
description: 'Check if the SMTP is enabled or not',
})
@UseGuards(GqlAuthGuard)
isSMTPEnabled() {
return this.infraConfigService.isSMTPEnabled();
}
/* Mutations */
@Mutation(() => [InfraConfig], {

View File

@@ -316,6 +316,16 @@ export class InfraConfigService implements OnModuleInit {
.split(',');
}
/**
* Check if SMTP is enabled or not
* @returns boolean
*/
isSMTPEnabled() {
return (
this.configService.get<string>('INFRA.MAILER_SMTP_ENABLE') === 'true'
);
}
/**
* Reset all the InfraConfigs to their default values (from .env)
*/