@goweekdays/core 2.15.5 → 2.15.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @goweekdays/core
2
2
 
3
+ ## 2.15.6
4
+
5
+ ### Patch Changes
6
+
7
+ - 87ea12d: Fix sending email
8
+
3
9
  ## 2.15.5
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -11100,22 +11100,23 @@ function useOrgService() {
11100
11100
  },
11101
11101
  filePath
11102
11102
  });
11103
- mailer.sendMail({
11103
+ await mailer.sendMail({
11104
11104
  to: verification.email,
11105
11105
  subject: "Welcome to GoWeekdays - Your Organization is Ready",
11106
11106
  from: `"GoWeekdays" <support@goweekdays.com>`,
11107
11107
  html: emailContent
11108
- }).catch((error2) => {
11109
- import_utils58.logger.log({
11110
- level: "error",
11111
- message: `Error sending user invite email: ${error2}`
11112
- });
11113
11108
  });
11114
11109
  await session?.commitTransaction();
11115
11110
  return "Successfully created organization with verification.";
11116
11111
  } catch (error2) {
11117
11112
  await session?.abortTransaction();
11118
- throw error2;
11113
+ if (error2 instanceof import_utils58.AppError) {
11114
+ throw error2;
11115
+ } else {
11116
+ throw new import_utils58.InternalServerError(
11117
+ "Failed to create organization with verification."
11118
+ );
11119
+ }
11119
11120
  } finally {
11120
11121
  await session?.endSession();
11121
11122
  }
@@ -11224,22 +11225,23 @@ function useOrgService() {
11224
11225
  },
11225
11226
  filePath
11226
11227
  });
11227
- mailer.sendMail({
11228
+ await mailer.sendMail({
11228
11229
  to: verification.email,
11229
11230
  subject: "Welcome to GoWeekdays - Your Organization is Ready",
11230
11231
  from: `"GoWeekdays" <support@goweekdays.com>`,
11231
11232
  html: emailContent
11232
- }).catch((error2) => {
11233
- import_utils58.logger.log({
11234
- level: "error",
11235
- message: `Error sending user invite email: ${error2}`
11236
- });
11237
11233
  });
11238
11234
  await session?.commitTransaction();
11239
11235
  return "Successfully created organization with verification.";
11240
11236
  } catch (error2) {
11241
11237
  await session?.abortTransaction();
11242
- throw error2;
11238
+ if (error2 instanceof import_utils58.AppError) {
11239
+ throw error2;
11240
+ } else {
11241
+ throw new import_utils58.InternalServerError(
11242
+ "Failed to create organization with verification."
11243
+ );
11244
+ }
11243
11245
  } finally {
11244
11246
  await session?.endSession();
11245
11247
  }
@@ -12133,16 +12135,11 @@ function useVerificationService() {
12133
12135
  },
12134
12136
  filePath: filePath2
12135
12137
  });
12136
- mailer.sendMail({
12138
+ await mailer.sendMail({
12137
12139
  to: email,
12138
12140
  subject: "Member Invite",
12139
12141
  html: emailContent2,
12140
12142
  from: `"GoWeekdays" <support@goweekdays.com>`
12141
- }).catch((error) => {
12142
- import_utils62.logger.log({
12143
- level: "error",
12144
- message: `Error sending user invite email: ${error}`
12145
- });
12146
12143
  });
12147
12144
  return res2;
12148
12145
  }
@@ -12155,20 +12152,19 @@ function useVerificationService() {
12155
12152
  },
12156
12153
  filePath
12157
12154
  });
12158
- mailer.sendMail({
12155
+ await mailer.sendMail({
12159
12156
  to: email,
12160
12157
  subject: "User Invite",
12161
12158
  html: emailContent,
12162
12159
  from: `"GoWeekdays" <support@goweekdays.com>`
12163
- }).catch((error) => {
12164
- import_utils62.logger.log({
12165
- level: "error",
12166
- message: `Error sending user invite email: ${error}`
12167
- });
12168
12160
  });
12169
12161
  return res;
12170
12162
  } catch (error) {
12171
- throw error;
12163
+ if (error instanceof import_utils62.AppError) {
12164
+ throw error;
12165
+ } else {
12166
+ throw new import_utils62.InternalServerError("Failed to create user invitation.");
12167
+ }
12172
12168
  }
12173
12169
  }
12174
12170
  async function createForgetPassword(email) {
@@ -12190,20 +12186,19 @@ function useVerificationService() {
12190
12186
  },
12191
12187
  filePath
12192
12188
  });
12193
- mailer.sendMail({
12189
+ await mailer.sendMail({
12194
12190
  to: email,
12195
12191
  subject: "Forget Password",
12196
12192
  from: `"GoWeekdays" <support@goweekdays.com>`,
12197
12193
  html: emailContent
12198
- }).catch((error) => {
12199
- import_utils62.logger.log({
12200
- level: "error",
12201
- message: `Error sending forget password email: ${error}`
12202
- });
12203
12194
  });
12204
12195
  return "Successfully created a link to reset password. Please check your email.";
12205
12196
  } catch (error) {
12206
- throw new import_utils62.InternalServerError("Failed to create forget password link.");
12197
+ if (error instanceof import_utils62.AppError) {
12198
+ throw error;
12199
+ } else {
12200
+ throw new import_utils62.InternalServerError("Failed to create forget password link.");
12201
+ }
12207
12202
  }
12208
12203
  }
12209
12204
  async function getById(id) {
@@ -12380,20 +12375,19 @@ function useVerificationService() {
12380
12375
  },
12381
12376
  filePath
12382
12377
  });
12383
- mailer.sendMail({
12378
+ await mailer.sendMail({
12384
12379
  to: email,
12385
12380
  subject: "Sign Up Verification",
12386
12381
  html: emailContent,
12387
12382
  from: `"GoWeekdays" <support@goweekdays.com>`
12388
- }).catch((error) => {
12389
- import_utils62.logger.log({
12390
- level: "error",
12391
- message: `Error sending user invite email: ${error}`
12392
- });
12393
12383
  });
12394
12384
  return res;
12395
12385
  } catch (error) {
12396
- throw error;
12386
+ if (error instanceof import_utils62.AppError) {
12387
+ throw error;
12388
+ } else {
12389
+ throw new import_utils62.InternalServerError("Failed to create sign up verification.");
12390
+ }
12397
12391
  }
12398
12392
  }
12399
12393
  const { getByOrg } = useSubscriptionRepo();
@@ -12472,16 +12466,11 @@ function useVerificationService() {
12472
12466
  },
12473
12467
  filePath: filePath2
12474
12468
  });
12475
- mailer.sendMail({
12469
+ await mailer.sendMail({
12476
12470
  to: value.email,
12477
12471
  subject: "Member Invite",
12478
12472
  html: emailContent2,
12479
12473
  from: `"GoWeekdays" <support@goweekdays.com>`
12480
- }).catch((error2) => {
12481
- import_utils62.logger.log({
12482
- level: "error",
12483
- message: `Error sending user invite email: ${error2}`
12484
- });
12485
12474
  });
12486
12475
  return verificationId2;
12487
12476
  }
@@ -12494,7 +12483,7 @@ function useVerificationService() {
12494
12483
  },
12495
12484
  filePath
12496
12485
  });
12497
- mailer.sendMail({
12486
+ await mailer.sendMail({
12498
12487
  to: value.email,
12499
12488
  subject: "User Invite",
12500
12489
  html: emailContent,