Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Backend/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ CREATE TABLE IF NOT EXISTS profile (

INSERT INTO profile (lmp, cycleLength, periodLength, age, weight, user_location) VALUES
('2025-01-01', 28, 5, 30, 65, 'New York'),
('2025-01-15', 30, 6, 28, 70, 'Los Angeles'),
('2025-01-15', 30, 6,
28, 70, 'Los Angeles'),
('2025-02-01', 26, 4, 32, 60, 'Chicago');


Expand Down
8 changes: 8 additions & 0 deletions Frontend/.expo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
> Why do I have a folder named ".expo" in my project?
The ".expo" folder is created when an Expo project is started using "expo start" command.
> What do the files contain?
- "devices.json": contains information about devices that have recently opened this project. This is used to populate the "Development sessions" list in your development builds.
- "settings.json": contains the server configuration that is used to serve the application manifest.
> Should I commit the ".expo" folder?
No, you should not share the ".expo" folder. It does not contain any information that is relevant for other developers working on the project, it is specific to your machine.
Upon project creation, the ".expo" folder is already added to your ".gitignore" file.
3 changes: 3 additions & 0 deletions Frontend/.expo/devices.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"devices": []
}
Comment on lines +1 to +3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check .gitignore for .expo entries
echo "=== Checking .gitignore for .expo ==="
if [ -f .gitignore ]; then
  grep -n "\.expo" .gitignore || echo ".expo not found in .gitignore"
else
  echo ".gitignore not found"
fi

echo ""
echo "=== Files in Frontend/.expo being tracked ==="
git ls-files Frontend/.expo/ 2>/dev/null || echo "No tracked files found"

echo ""
echo "=== Checking for README.md in Frontend/.expo ==="
if [ -f Frontend/.expo/README.md ]; then
  echo "README.md found. First 20 lines:"
  head -20 Frontend/.expo/README.md
else
  echo "README.md not found in Frontend/.expo"
fi

echo ""
echo "=== Directory structure of Frontend/.expo ==="
find Frontend/.expo -type f 2>/dev/null | head -20

Repository: AOSSIE-Org/BabyNest

Length of output: 1164


Add .expo to .gitignore and remove tracked files.

The .expo folder is currently being tracked in version control (Frontend/.expo/README.md and Frontend/.expo/devices.json), but according to the README.md in this folder, it "does not contain any information that is relevant for other developers working on the project, it is specific to your machine." Add /.expo/ to the repository's .gitignore and remove these files from the commit.

🤖 Prompt for AI Agents
In Frontend/.expo/ (lines 1-3) the files Frontend/.expo/README.md and
Frontend/.expo/devices.json are being tracked but are machine-specific; add
"/.expo/" to the repository .gitignore, remove the tracked files from Git with
git rm --cached Frontend/.expo/README.md Frontend/.expo/devices.json (or git rm
-r --cached Frontend/.expo), commit the change with a clear message (e.g.,
"chore: ignore .expo and remove tracked files"), and push the commit so the
.expo folder stays untracked going forward.

31 changes: 18 additions & 13 deletions Frontend/App.jsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
import React from 'react';
import React, { useEffect } from 'react';
import { NavigationContainer } from '@react-navigation/native';
import { Provider as PaperProvider} from 'react-native-paper';
import { Provider as PaperProvider } from 'react-native-paper';
import { ThemeProvider } from './src/theme/ThemeContext';
import { AgentProvider } from './src/context/AgentContext';
import StackNavigation from './src/navigation/StackNavigator';

import { initNotifications } from './src/services/notification-service';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Critical: Import path doesn't match actual file name.

The import uses './src/services/notification-service' but the actual file is named NotificationService.js (PascalCase). This will cause a module resolution error at runtime.

🔎 Fix import path
-import { initNotifications } from './src/services/notification-service';
+import { initNotifications } from './src/services/NotificationService';
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import { initNotifications } from './src/services/notification-service';
import { initNotifications } from './src/services/NotificationService';
🤖 Prompt for AI Agents
In Frontend/App.jsx around line 7, the import path uses
'./src/services/notification-service' but the actual module file is named
NotificationService.js (PascalCase); update the import to point to the correct
file name (e.g. './src/services/NotificationService' or
'./src/services/NotificationService.js') and verify that the exported symbol is
named initNotifications (adjust the import name if the module exports a
different identifier), or alternatively rename the file to match the import
(notification-service.js) so the file name and import casing agree.


export default function App() {

useEffect(() => {
initNotifications();
}, []);
Comment on lines +11 to +13
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major

Add error handling for notification initialization.

If notification initialization fails (e.g., due to missing permissions or unsupported platform), the app will crash or fail silently. Consider adding error handling to gracefully handle initialization failures.

🔎 Add try-catch for initialization
   useEffect(() => {
-    initNotifications();
+    try {
+      initNotifications();
+    } catch (error) {
+      console.error('Failed to initialize notifications:', error);
+      // App can continue without notifications
+    }
   }, []);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
useEffect(() => {
initNotifications();
}, []);
useEffect(() => {
try {
initNotifications();
} catch (error) {
console.error('Failed to initialize notifications:', error);
// App can continue without notifications
}
}, []);
🤖 Prompt for AI Agents
In Frontend/App.jsx around lines 11 to 13, the useEffect calls
initNotifications() with no error handling which can crash or fail silently if
initialization throws (permissions/platform issues). Wrap the initNotifications
call in a try-catch inside the useEffect, call initNotifications await if it
returns a promise, and on error log the error (console.error or app logger) and
set a safe fallback state or disable notification features so the app continues
running gracefully; optionally surface a non-blocking user-facing message that
notifications are unavailable.


return (
<PaperProvider>
<ThemeProvider>
<AgentProvider>
<NavigationContainer>
<StackNavigation />
</NavigationContainer>
</AgentProvider>
</ThemeProvider>
</PaperProvider >
<PaperProvider>
<ThemeProvider>
<AgentProvider>
<NavigationContainer>
<StackNavigation />
</NavigationContainer>
</AgentProvider>
</ThemeProvider>
</PaperProvider>
);
}
}
106 changes: 103 additions & 3 deletions Frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion Frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@
"react-native-toast-message": "^2.2.1",
"react-native-vector-icons": "^10.2.0",
"react-navigation": "^4.4.4",
"react-navigation-bottom-tabs": "^1.0.2"
"react-navigation-bottom-tabs": "^1.0.2",
"react-dom": "18.3.1",
"react-native-web": "~0.19.13",
"@expo/metro-runtime": "~4.0.1"
Comment on lines +46 to +48
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

# First, locate NotificationService.js
find . -name "NotificationService.js" -o -name "*Notification*Service*" | head -20

Repository: AOSSIE-Org/BabyNest

Length of output: 109


🏁 Script executed:

# Check the Frontend/package.json file to see current dependencies
cat Frontend/package.json

Repository: AOSSIE-Org/BabyNest

Length of output: 2565


🌐 Web query:

react-native-push-notification latest version compatible React Native 0.77.1

💡 Result:

Latest published release: react-native-push-notification v8.1.1. [GitHub releases][1], [npm/Snyk][2]

Compatibility note: the original zo0r repository was archived (read‑only) in Jan 2025 and the package shows signs of low maintenance; there is no official statement guaranteeing support for React Native 0.77.1. Test v8.1.1 in your project (or consider maintained alternatives/forks) before upgrading to RN 0.77.1. [GitHub archive][1], [Snyk/npm][2]

Sources:
[1] GitHub releases — zo0r/react-native-push-notification (v8.1.1).
[2] npm / security listing for react-native-push-notification (latest v8.1.1).


🏁 Script executed:

# Check what NotificationService.js actually imports
cat Frontend/src/services/NotificationService.js

Repository: AOSSIE-Org/BabyNest

Length of output: 1111


Critical: Missing react-native-push-notification dependency.

NotificationService.js imports react-native-push-notification at the top of the file, but this package is not listed in dependencies. This will cause a runtime import error when the notification service initializes.

Add the following to the dependencies section:

     "react-navigation": "^4.4.4",
     "react-navigation-bottom-tabs": "^1.0.2",
     "react-dom": "18.3.1",
     "react-native-web": "~0.19.13",
-    "@expo/metro-runtime": "~4.0.1"
+    "@expo/metro-runtime": "~4.0.1",
+    "react-native-push-notification": "^8.1.1"

Note: The upstream react-native-push-notification package was archived in January 2025 and shows no official support for React Native 0.77.1. Test this version thoroughly in your environment, or consider maintained alternatives/community forks.

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
Frontend/package.json around lines 46-48: package.json is missing the
react-native-push-notification dependency required by NotificationService.js —
add an appropriate version of "react-native-push-notification" to the
dependencies section of package.json, run your package manager install to update
lockfiles, rebuild the app and verify NotificationService initializes without
import/runtime errors; if compatibility issues arise with RN 0.77.1, swap to a
maintained fork or alternative notification library and update imports
accordingly.

},
"devDependencies": {
"@babel/core": "^7.25.2",
Expand Down
7 changes: 7 additions & 0 deletions Frontend/src/Screens/CalendarScreen.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, {useEffect, useRef, useState} from 'react';
import { scheduleNotification } from '../services/notification-service';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Critical: Import path doesn't match actual file name.

The import uses '../services/notification-service' but the actual file is named NotificationService.js (PascalCase). This will cause a module resolution error at runtime.

🔎 Fix import path
-import { scheduleNotification } from '../services/notification-service';
+import { scheduleNotification } from '../services/NotificationService';
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import { scheduleNotification } from '../services/notification-service';
import { scheduleNotification } from '../services/NotificationService';
🤖 Prompt for AI Agents
In Frontend/src/Screens/CalendarScreen.jsx around line 2, the import path uses
'../services/notification-service' but the actual module file is named
NotificationService.js; update the import to point to the correct filename (e.g.
'../services/NotificationService' or '../services/NotificationService.js') so
the module resolves at runtime, keeping the named import scheduleNotification
as-is and adjusting the path casing to match the filesystem.

import {
View,
Text,
Expand Down Expand Up @@ -167,6 +168,12 @@ const ScheduleScreen = () => {
appointment_location: '',
});
fetchAppointments();
scheduleNotification(
'Appointment Reminder',
newAppointment.title,
`${newAppointment.appointment_date}T${newAppointment.appointment_time}:00`
);
Comment on lines +171 to +175
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Major: Notification scheduled AT appointment time, not in advance.

The notification is scheduled for the exact appointment time (${newAppointment.appointment_date}T${newAppointment.appointment_time}:00), which defeats the purpose of a reminder. Users need advance notice (e.g., 1 hour or 1 day before) to prepare for their appointment.

🔎 Schedule reminder in advance
+        // Schedule reminder 1 hour before appointment
+        const appointmentDateTime = new Date(`${newAppointment.appointment_date}T${newAppointment.appointment_time}:00`);
+        const reminderTime = new Date(appointmentDateTime.getTime() - 60 * 60 * 1000);
+        
         scheduleNotification(
           'Appointment Reminder',
           newAppointment.title,
-          `${newAppointment.appointment_date}T${newAppointment.appointment_time}:00`
+          reminderTime
         );
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
scheduleNotification(
'Appointment Reminder',
newAppointment.title,
`${newAppointment.appointment_date}T${newAppointment.appointment_time}:00`
);
// Schedule reminder 1 hour before appointment
const appointmentDateTime = new Date(`${newAppointment.appointment_date}T${newAppointment.appointment_time}:00`);
const reminderTime = new Date(appointmentDateTime.getTime() - 60 * 60 * 1000);
scheduleNotification(
'Appointment Reminder',
newAppointment.title,
reminderTime
);

🛠️ Refactor suggestion | 🟠 Major

Add error handling and validation for notification scheduling.

Issues:

  1. No error handling if scheduleNotification fails
  2. No validation that the datetime string is properly formatted
  3. Past dates could be scheduled without warning
🔎 Add validation and error handling
+        try {
+          const appointmentDateTime = new Date(`${newAppointment.appointment_date}T${newAppointment.appointment_time}:00`);
+          
+          if (isNaN(appointmentDateTime.getTime())) {
+            throw new Error('Invalid appointment date/time format');
+          }
+          
+          const reminderTime = new Date(appointmentDateTime.getTime() - 60 * 60 * 1000);
+          
+          if (reminderTime < new Date()) {
+            console.warn('Appointment time is too soon for advance reminder');
+          }
+          
-scheduleNotification(
-  'Appointment Reminder',
-  newAppointment.title,
-  `${newAppointment.appointment_date}T${newAppointment.appointment_time}:00`
-);
+          scheduleNotification(
+            'Appointment Reminder',
+            newAppointment.title,
+            reminderTime
+          );
+        } catch (notifErr) {
+          console.error('Failed to schedule notification:', notifErr);
+          Toast.show({
+            type: 'error',
+            text1: 'Notification scheduling failed',
+            text2: 'Appointment saved but reminder not set',
+            visibilityTime: 2000,
+            position: 'bottom',
+          });
+        }

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In Frontend/src/Screens/CalendarScreen.jsx around lines 171-175, the call to
scheduleNotification lacks validation and error handling; parse and validate the
combined datetime string by constructing a Date object (ensure it's valid via
!isNaN(date.getTime())), verify the date is in the future (compare to
Date.now()), and only call scheduleNotification when both checks pass; wrap the
scheduling call in a try/catch or handle the returned Promise rejection to log
the error and show user feedback (toast/alert) on failure, and bail out with an
appropriate message if validation fails.



Toast.show({
type: 'success',
Expand Down
Loading