CLASSROOMIO-T-155:Send email notification to students when exercise status changes

Merge branch 'CLASSROOMIO-T-155' of https://gitlab.com/thenextgreat/classroomio into CLASSROOMIO-T-155

remove consoles

CLASSROOMIO-T-155:Cleanup

Improve email and fix fetching exercise in lms

CLASSROOMIO-T-155: Improve from name

Merge branch 'main' of https://gitlab.com/thenextgreat/classroomio into CLASSROOMIO-T-155

CLASSROOMIO-T-155:Cleanup

CLASSROOMIO-T-155:Implemented the email notification

Merge branch 'main' into CLASSROOMIO-T-155

CLASSROOMIO-T-155:Working on the email notification


Co-authored-by: Ifeanyi Nwosu <[email protected]>
Co-authored-by: Rotimi Best <[email protected]>


Merge-request: CLASSROOMIO-MR-107
Merged-by: Best Admin <[email protected]>
This commit is contained in:
emmanuel
2023-10-18 08:09:52 +00:00
committed by Space Cloud
co-authored by Rotimi Best
parent 21b0583077
commit bf73c8cf5a
8 changed files with 228 additions and 85 deletions
@@ -27,9 +27,9 @@ export async function POST({ request }) {
}
await sendEmail({
from: `"${orgName} - ClassroomIO" <[email protected]>`,
from: `"${orgName} (via ClassroomIO.com)" <[email protected]>`,
to,
subject: `[${orgName}] Welcome to Class 🎉`,
subject: `${orgName} - Welcome to Class 🎉`,
content: `
<p>Hi there,</p>
<p>Congratulations 🎉, you’ve successfully joined: <strong>${courseName}</strong></p>
@@ -0,0 +1,38 @@
import { json } from '@sveltejs/kit';
import { getSupabase } from '$lib/utils/functions/supabase';
import { sendEmail } from '$lib/utils/services/notification/send';
const supabase = getSupabase();
export async function POST({ request }) {
const { to, content, orgName } = await request.json();
const accessToken = request.headers.get('Authorization') || '';
if (!to || !content || !orgName) {
return json({ success: false, message: 'Missing required fields' }, { status: 400 });
}
let user;
try {
const { data } = await supabase.auth.getUser(accessToken);
user = data.user;
} catch (error) {
console.error(error);
}
if (!user) {
return json({ success: false, message: 'Unauthenticated user' }, { status: 401 });
}
await sendEmail({
from: `"${orgName} (via ClassroomIO.com)" <[email protected]>`,
to,
subject: `Submission Update`,
content
});
return json({
success: true,
message: 'Email sent'
});
}
@@ -29,7 +29,7 @@ export async function POST({ request }) {
const inviteLink = `${origin}/org/${orgSiteName}/courses`;
await sendEmail({
from: `"[${orgName}] - ClassroomIO" <[email protected]>`,
from: `"${orgName} (via ClassroomIO.com)" <[email protected]>`,
to,
subject: `You have been invited to a course in ${orgName}!`,
content: `