+
+ Choose the users you would like to email in{' '}
+ {leagueName}.
+
+
+
+
+ All users
+
+
+
+ Only the survivors
+
+
+
+ Only the losers
+
+
+
);
};
diff --git a/app/(admin)/admin/notifications/serverFunctions/serverFunctionHelper.test.tsx b/app/(admin)/admin/notifications/serverFunctions/serverFunctionHelper.test.tsx
new file mode 100644
index 00000000..b70b3444
--- /dev/null
+++ b/app/(admin)/admin/notifications/serverFunctions/serverFunctionHelper.test.tsx
@@ -0,0 +1,52 @@
+// Copyright (c) Gridiron Survivor.
+// Licensed under the MIT License.
+
+'use server';
+import { messaging } from '@/api/serverConfig';
+import { sendEmailNotifications } from './serverFunctionHelper';
+
+jest.mock('./serverFunctionHelper', () => ({
+ sendEmailNotifications: jest.fn(),
+}));
+
+jest.mock('@/api/serverConfig', () => ({
+ messaging: {
+ createEmail: jest.fn(),
+ },
+}));
+
+describe('SendEmailNotification', () => {
+ it('should send email with provided information', async () => {
+ const content = 'Test';
+ const groupUsers = ['123456', '12345', '1234'];
+ const subject = 'This is a test';
+
+ (sendEmailNotifications as jest.Mock).mockImplementation(
+ async ({ content, groupUsers, subject }) => {
+ await (messaging.createEmail as jest.Mock)(
+ '1234567890',
+ subject,
+ content,
+ [],
+ '1234567890',
+ [],
+ [],
+ groupUsers,
+ );
+ },
+ );
+
+ await sendEmailNotifications({ content, groupUsers, subject });
+
+ expect(messaging.createEmail).toHaveBeenCalledWith(
+ expect.any(String),
+ subject,
+ content,
+ [],
+ '1234567890',
+ [],
+ [],
+ groupUsers,
+ );
+ });
+});
diff --git a/app/(admin)/admin/notifications/serverFunctions/serverFunctionHelper.ts b/app/(admin)/admin/notifications/serverFunctions/serverFunctionHelper.ts
new file mode 100644
index 00000000..718798d3
--- /dev/null
+++ b/app/(admin)/admin/notifications/serverFunctions/serverFunctionHelper.ts
@@ -0,0 +1,62 @@
+// Copyright (c) Gridiron Survivor.
+// Licensed under the MIT License.
+
+'use server';
+import { ID } from 'appwrite';
+import { messaging, users } from '@/api/serverConfig';
+
+/**
+ * Function to send email.
+ * @param props - subject, content.
+ * @param props.content - The actual email you are wanting to send.
+ * @param props.groupUsers - User id's being passed in from the notification page.
+ * @param props.subject - The subject of the email.
+ */
+export const sendEmailNotifications = async ({
+ content,
+ groupUsers,
+ subject,
+}: {
+ content: string;
+ groupUsers: string[];
+ subject: string;
+}): Promise