format
This commit is contained in:
1 parent
118372630e
commit
102bd0a5f8
2 files changed
+9
-45
No files matched your search
@@ -1,4 +1,12 @@
|
||||
import type { Check, ChecksQueryResult, ChecksSummary, MonitorType, PageSpeedChecksResult, HardwareChecksResult, UptimeChecksResult } from "@/types/index.js";
|
||||
import type {
|
||||
Check,
|
||||
ChecksQueryResult,
|
||||
ChecksSummary,
|
||||
MonitorType,
|
||||
PageSpeedChecksResult,
|
||||
HardwareChecksResult,
|
||||
UptimeChecksResult,
|
||||
} from "@/types/index.js";
|
||||
import type { LatestChecksMap } from "@/repositories/checks/MongoChecksRepistory.js";
|
||||
|
||||
export interface IChecksRepository {
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
const SERVICE_NAME = "inviteService";
|
||||
|
||||
class InviteService {
|
||||
static SERVICE_NAME = SERVICE_NAME;
|
||||
|
||||
constructor({ db, settingsService, emailService, stringService, errorService }) {
|
||||
this.db = db;
|
||||
this.settingsService = settingsService;
|
||||
this.emailService = emailService;
|
||||
this.stringService = stringService;
|
||||
this.errorService = errorService;
|
||||
}
|
||||
|
||||
get serviceName() {
|
||||
return InviteService.SERVICE_NAME;
|
||||
}
|
||||
|
||||
getInviteToken = async ({ invite, teamId }) => {
|
||||
invite.teamId = teamId;
|
||||
const inviteToken = await this.db.inviteModule.requestInviteToken(invite);
|
||||
return inviteToken;
|
||||
};
|
||||
|
||||
sendInviteEmail = async ({ inviteRequest, firstName }) => {
|
||||
const inviteToken = await this.db.inviteModule.requestInviteToken({ ...inviteRequest });
|
||||
const { clientHost } = this.settingsService.getSettings();
|
||||
|
||||
const html = await this.emailService.buildEmail("employeeActivationTemplate", {
|
||||
name: firstName,
|
||||
link: `${clientHost}/register/${inviteToken.token}`,
|
||||
});
|
||||
const result = await this.emailService.sendEmail(inviteRequest.email, "Welcome to Uptime Monitor", html);
|
||||
if (!result) {
|
||||
throw this.errorService.createServerError("Failed to send invite e-mail... Please verify your settings.");
|
||||
}
|
||||
};
|
||||
|
||||
verifyInviteToken = async ({ inviteToken }) => {
|
||||
const invite = await this.db.inviteModule.getInviteToken(inviteToken);
|
||||
return invite;
|
||||
};
|
||||
}
|
||||
|
||||
export default InviteService;
|
||||
Reference in new issue
Block a user