refactor invite module into class

This commit is contained in:
Alex Holliday committed 2025-07-29 19:53:11 -07:00
1 parent f934bbf829
commit ca02ed9d18
5 files changed
+60 -102

No files matched your search

+3 -3
View File
@@ -17,12 +17,12 @@ class InviteService {
getInviteToken = async ({ invite, teamId }) => {
invite.teamId = teamId;
const inviteToken = await this.db.requestInviteToken(invite);
const inviteToken = await this.db.inviteModule.requestInviteToken(invite);
return inviteToken;
};
sendInviteEmail = async ({ inviteRequest, firstName }) => {
const inviteToken = await this.db.requestInviteToken({ ...inviteRequest });
const inviteToken = await this.db.inviteModule.requestInviteToken({ ...inviteRequest });
const { clientHost } = this.settingsService.getSettings();
const html = await this.emailService.buildEmail("employeeActivationTemplate", {
@@ -36,7 +36,7 @@ class InviteService {
};
verifyInviteToken = async ({ inviteToken }) => {
const invite = await this.db.getInviteToken(inviteToken);
const invite = await this.db.inviteModule.getInviteToken(inviteToken);
return invite;
};
}
+1 -1
View File
@@ -31,7 +31,7 @@ class UserService {
// If superAdmin exists, a token should be attached to all further register requests
const superAdminExists = await this.db.checkSuperadmin();
if (superAdminExists) {
const invitedUser = await this.db.getInviteTokenAndDelete(user.inviteToken);
const invitedUser = await this.db.inviteModule.getInviteTokenAndDelete(user.inviteToken);
user.role = invitedUser.role;
user.teamId = invitedUser.teamId;
} else {