Skip to content
This repository has been archived by the owner on May 2, 2022. It is now read-only.

Commit

Permalink
#21 WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexialsousa committed Apr 13, 2022
1 parent b40ce5f commit 0e923f8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
12 changes: 12 additions & 0 deletions functions/src/triage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,18 @@ export const requestDoctor = functions.https.onCall(async (_data, context)=>{
};
sendNotificationHelper(availableDoc.UID, message);

// send notification to doctor
const patientMessage: UserNotification = {
title: "New Doctor",
message: `Dr. ${availableDoc.lastName} has been assigned to you`,
date: admin.firestore.Timestamp.now(),
read: false,
conversationID: null,
};
if (userId) {
sendNotificationHelper(userId, patientMessage);
}

// decrement available Slots
const newfilledSlots = availableDoctorRef.data().filledSlots +1;
const newAvailableSlots = availableDoctorRef.data().patientSlots - newfilledSlots;
Expand Down
5 changes: 4 additions & 1 deletion src/components/dashboard/PatientView/PatientDashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import Header from '../../layout/Header';
import MainContent from '../../layout/MainContent';
import { UserContext } from '../../../context/UserContext';
import { firestore } from '../../../config/firebase_config';
import NotificationsButton from '../../layout/NotificationsButton';

function PatientDashboard(props: { setContentId: any }) {
const theme = useTheme();
Expand Down Expand Up @@ -96,6 +97,9 @@ function PatientDashboard(props: { setContentId: any }) {
Ask for Help
</Button>
)}
{user?.assignedDoctor && (
<NotificationsButton />
)}
</div>
</Header>
<MainContent>
Expand Down Expand Up @@ -150,7 +154,6 @@ function PatientDashboard(props: { setContentId: any }) {
</Paper>
</Container>
)}

<Typography
variant="h5"
sx={{
Expand Down

0 comments on commit 0e923f8

Please sign in to comment.