• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

atlp-rwanda / champs-ec-be / 3830ef7e-e46a-4c27-8d28-dc6765443b01

08 May 2024 07:43AM UTC coverage: 86.615% (-0.3%) from 86.928%
3830ef7e-e46a-4c27-8d28-dc6765443b01

Pull #60

circleci

RwigimbaP-dev
ft(feature):admin should be able to feature/unfeature a product
Pull Request #60: #187527339 Feature Product

295 of 416 branches covered (70.91%)

Branch coverage included in aggregate %.

54 of 60 new or added lines in 4 files covered. (90.0%)

2 existing lines in 2 files now uncovered.

1478 of 1631 relevant lines covered (90.62%)

3.48 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

92.0
/src/utils/mailer.ts
1
import { config } from "dotenv";
1✔
2
import nodemailer from "nodemailer";
1✔
3

4
config();
1✔
5

6
const appUrl: string =
7
  process.env.DB_HOST_TYPE === "local"
1!
8
    ? `http://localhost:${process.env.PORT}/`
9
    : "https://champs-ec-be.onrender.com/";
10

11
export const transporter = nodemailer.createTransport({
1✔
12
  service: "gmail",
13
  auth: {
14
    user: process.env.EMAIL_USERNAME as string,
15
    pass: process.env.EMAIL_PASSWORD as string
16
  }
17
});
18

19
const mailOptions = {
1✔
20
  from: `"Champs bay" <atlptestauth@gmail.com>`,
21
  to: "",
22
  subject: "",
23
  text: ""
24
};
25

26
export const sendMail = async (options: any) => {
1✔
27
  try {
10✔
28
    const info = await transporter.sendMail(options);
10✔
UNCOV
29
    console.log("Email sent: ", info.response);
×
30
  } catch (error) {
31
    console.error("Error sending email: ", error);
10✔
32
  }
33
};
34

35
export const sendVerificationMail = (
1✔
36
  mail: string,
37
  link: string,
38
  name: string
39
) => {
40
  const options = {
2✔
41
    ...mailOptions,
42
    to: mail,
43
    subject: "Account Verification Required: Please Verify Your Account",
44
    text: `
45
      Hi ${name},
46
      Thank you for signing up with us! 
47
      To complete your registration and gain access to all features, please click the link below to verify your email address:
48
      - Please click here to verify your account ${appUrl}${link}
49
      If you did not create an account with us, please disregard this email.
50
      Regards,
51
      Champs Bay
52
    `
53
  };
54
  sendMail(options);
2✔
55
};
56

57
// mailer functions
58
export const sendOTPCode = (email: string, code: string) => {
1✔
59
  const options = {
4✔
60
    ...mailOptions,
61
    to: email,
62
    subject: "Verification code",
63
    html: `
64
          <p style="font-size:15px; color:black;">
65
              Hello,<br>
66
              Here is your verification code:<br>
67
              Verification Code: <strong style="font-size: 20px;">${code}</strong><br>
68
              Please enter this code on the verification page to confirm your identity.<br>
69
              Thank you for using our service.<br>
70
              Champs Bay
71
          </p>
72
    `
73
  };
74
  sendMail(options);
4✔
75
};
76

77
export const sendResetMail = (email: string, link: string, name: string) => {
1✔
78
  const options = {
1✔
79
    ...mailOptions,
80
    to: email,
81
    subject: "Password reset request",
82
    text: `
83
      Hi ${name},
84
      you are trying to reset your password:
85
      [Verification Code: ]
86
      To continue to reset your password please click on the link below in the next 60 minutes. 
87
      ${link}
88
      Thank you for using our service.
89
      Champs Bay
90
    `
91
  };
92
  sendMail(options);
1✔
93
};
94

95
export const sendNotificationInactiveAccount = (
1✔
96
  mail: string,
97
  name: string,
98
  message: string
99
) => {
100
  const options = {
2✔
101
    ...mailOptions,
102
    to: mail,
103
    subject: "User account status notification",
104
    html: `
105
  
106
    ${message}
107
   
108
    <br/><br/>
109
    Regards,
110
      Champs Bay
111
    `
112
  };
113
  sendMail(options);
2✔
114
};
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc