mirror of
https://github.com/open-reception/appointment-booking-software.git
synced 2026-09-29 20:24:50 +02:00
Small fixes to email service
This commit is contained in:
@@ -5,11 +5,7 @@ import {
|
||||
type TemplateData,
|
||||
type Language
|
||||
} from "./template-engine";
|
||||
import type {
|
||||
SelectClient,
|
||||
SelectStaff,
|
||||
SelectAppointment
|
||||
} from "$lib/server/db/schema";
|
||||
import type { SelectClient, SelectStaff, SelectAppointment } from "$lib/server/db/tenant-schema";
|
||||
import type { SelectTenant } from "$lib/server/db/central-schema";
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import nodemailer from "nodemailer";
|
||||
import { env } from "$env/dynamic/private";
|
||||
import type { SelectClient, SelectStaff } from "$lib/server/db/schema";
|
||||
import type { SelectClient, SelectStaff } from "$lib/server/db/tenant-schema";
|
||||
import type Mail from "nodemailer/lib/mailer";
|
||||
|
||||
/**
|
||||
@@ -48,16 +48,16 @@ function createTransporter() {
|
||||
if (!env.SMTP_HOST || !env.SMTP_PORT || !env.SMTP_USER || !env.SMTP_PASS) {
|
||||
throw new Error("SMTP configuration is incomplete. Please check your environment variables.");
|
||||
}
|
||||
|
||||
return nodemailer.createTransport({
|
||||
const config = {
|
||||
host: env.SMTP_HOST,
|
||||
port: parseInt(env.SMTP_PORT),
|
||||
secure: env.SMTP_SECURE === "true", // true for 465, false for other ports
|
||||
secure: env.SMTP_SECURE === "true",
|
||||
auth: {
|
||||
user: env.SMTP_USER,
|
||||
pass: env.SMTP_PASS
|
||||
}
|
||||
});
|
||||
};
|
||||
return nodemailer.createTransport(config);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -47,11 +47,7 @@ registerOpenAPIRoute("/admin/init", "POST", {
|
||||
example: "MySecurePassphrase123"
|
||||
}
|
||||
},
|
||||
required: ["name", "email"],
|
||||
oneOf: [
|
||||
{ required: ["passkey"] },
|
||||
{ required: ["passphrase"] }
|
||||
]
|
||||
required: ["name", "email"]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -122,11 +118,11 @@ export const POST: RequestHandler = async ({ request }) => {
|
||||
// Validate that either passkey or passphrase is provided (but not both)
|
||||
const hasPasskey = !!body.passkey;
|
||||
const hasPassphrase = !!body.passphrase;
|
||||
|
||||
|
||||
if (!hasPasskey && !hasPassphrase) {
|
||||
return json({ error: "Either passkey or passphrase must be provided" }, { status: 400 });
|
||||
}
|
||||
|
||||
|
||||
if (hasPasskey && hasPassphrase) {
|
||||
return json({ error: "Cannot provide both passkey and passphrase" }, { status: 400 });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user