chore: move backend to hono + typescript (#558)
* feat: setup secure presigned uploads and downloads * clean up * update lock * Get presigned url finally working * 557: Migrate backend to hono + ts * chore: update Dockerfile and package.json for backend configuration * add dev command * remove unused packages * Enhance backend API and frontend components for course management - Updated CORS configuration in the backend to allow specific methods and headers. - Refactored lesson download endpoint to use a new route for PDF downloads. - Removed unused certificate download functionality from the lesson router. - Updated frontend components to reflect changes in API endpoints and improve video upload functionality. - Introduced new video upload component and adjusted video handling in lesson materials. - Cleaned up unnecessary imports and optimized component structure for better performance. * PR cleanups * Enhance email configuration by adding SMTP_SENDER environment variable - Updated docker-compose.yaml to include SMTP_SENDER. - Modified Dockerfile to accept SMTP_SENDER as an argument. - Updated environment schema in env.ts to define SMTP_SENDER as optional. - Adjusted mail service to use SMTP_SENDER for the email 'from' field. - Updated documentation to reflect the new SMTP_SENDER variable. * Remove debug log statement from sendEmail function --------- Co-authored-by: Iniubong Obonguko <iniubongobonguko2018@gmail.com>
This commit is contained in:
co-authored by
Iniubong Obonguko
parent
9eb7b01587
commit
82be557a42
@@ -1,35 +1,36 @@
|
||||
import { env } from '$env/dynamic/public';
|
||||
|
||||
const sendEmail = async (
|
||||
emailDataArray: {
|
||||
from?: string;
|
||||
to: string;
|
||||
subject: string;
|
||||
content: string;
|
||||
replyTo?: string;
|
||||
isPersonalEmail?: boolean;
|
||||
}[]
|
||||
) => {
|
||||
try {
|
||||
const response = await fetch(`${env.PUBLIC_SERVER_URL}/sendEmail`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(emailDataArray)
|
||||
});
|
||||
const sendEmail = (sFetch: typeof fetch) => {
|
||||
return async (
|
||||
emailDataArray: {
|
||||
from?: string;
|
||||
to: string;
|
||||
subject: string;
|
||||
content: string;
|
||||
replyTo?: string;
|
||||
isPersonalEmail?: boolean;
|
||||
}[]
|
||||
) => {
|
||||
try {
|
||||
const response = await sFetch(`${env.PUBLIC_SERVER_URL}/mail/send`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(emailDataArray)
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
console.log('Failed to send emails');
|
||||
if (!response.ok) {
|
||||
console.log('Failed to send emails');
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('Emails sent successfully:', response);
|
||||
return response;
|
||||
} catch (error) {
|
||||
console.error('Error sending emails:', error);
|
||||
return;
|
||||
}
|
||||
|
||||
const responseData = await response.json();
|
||||
console.log('Emails sent successfully:', responseData);
|
||||
return responseData;
|
||||
} catch (error) {
|
||||
console.error('Error sending emails:', error);
|
||||
return;
|
||||
}
|
||||
};
|
||||
};
|
||||
export default sendEmail;
|
||||
|
||||
Reference in New Issue
Block a user