mirror of
https://github.com/Litlyx/litlyx
synced 2025-12-10 07:48:37 +01:00
fix email env
This commit is contained in:
@@ -2,7 +2,16 @@ import { TProjectCount } from "@schema/ProjectsCounts";
|
||||
import { ProjectModel } from "@schema/ProjectSchema";
|
||||
import { UserModel } from "@schema/UserSchema";
|
||||
import { LimitNotifyModel } from "@schema/broker/LimitNotifySchema";
|
||||
import { sendLimitEmail50 } from '@services/EmailService';
|
||||
import EmailService from '@services/EmailService';
|
||||
import { requireEnv } from "../../shared/utilts/requireEnv";
|
||||
|
||||
|
||||
EmailService.createTransport(
|
||||
requireEnv('EMAIL_SERVICE'),
|
||||
requireEnv('EMAIL_HOST'),
|
||||
requireEnv('EMAIL_USER'),
|
||||
requireEnv('EMAIL_PASS'),
|
||||
);
|
||||
|
||||
export async function checkLimitsForEmail(projectCounts: TProjectCount) {
|
||||
|
||||
@@ -13,7 +22,7 @@ export async function checkLimitsForEmail(projectCounts: TProjectCount) {
|
||||
if (!project) return;
|
||||
const owner = await UserModel.findById(project.owner);
|
||||
if (!owner) return;
|
||||
await sendLimitEmail50(owner.email);
|
||||
await EmailService.sendLimitEmail50(owner.email);
|
||||
await LimitNotifyModel.updateOne({ project_id: projectCounts._id }, { limit1: true, limit2: false, limit3: false }, { upsert: true });
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user