Skip to content

feat: 86extdm6t#89

Open
rachelishteren wants to merge 5 commits into
mainfrom
appointment
Open

feat: 86extdm6t#89
rachelishteren wants to merge 5 commits into
mainfrom
appointment

Conversation

@rachelishteren

@rachelishteren rachelishteren commented Jun 14, 2026

Copy link
Copy Markdown
Collaborator

What was done

  • Added React Query integration for fetching next appointment data.
  • Replaced static appointment data with backend data.
  • Connected BottomSheetDialog to the fetched appointment.

Even after a lot of effort I couldn't get the backend to run, so I couldn't check if it actually works
I would be happy if you could check the code for me theoretically

Summary by CodeRabbit

  • New Features
    • Added an appointment bottom sheet that automatically fetches and displays the next appointment for the home page.
  • Refactor
    • Improved how appointment data and dialog visibility are handled: appointment selection is no longer managed locally on the home page, resulting in smoother bottom sheet open/close behavior.

@coderabbitai

coderabbitai Bot commented Jun 14, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@rachelishteren, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 30 minutes and 52 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e2aced1a-0da7-4bdc-9a1a-8b5cd66a5fda

📥 Commits

Reviewing files that changed from the base of the PR and between 3cbf76b and b5a9b64.

📒 Files selected for processing (2)
  • src/constants/index.ts
  • src/pages/home/AppointmentBottomSheet/AppointmentBottomSheet.tsx
📝 Walkthrough

Walkthrough

The PR extracts appointment fetching and bottom-sheet state management from the Home component into a new AppointmentBottomSheet component. An API endpoint constant is added, the new component is created with useQuery logic to fetch appointments, and Home is refactored to render the component instead of managing state locally.

Changes

Home Appointment Fetch Refactor

Layer / File(s) Summary
API endpoint constant
src/constants/api.constants.ts
API_ENDPOINTS now includes appointment: '/api/appointment/nextAppointment'.
AppointmentBottomSheet component
src/pages/home/AppointmentBottomSheet/AppointmentBottomSheet.tsx
New component manages selectedAppointment state and uses useQuery with hardcoded mock patientID and date to fetch an Appointment from API_ENDPOINTS.appointment, keyed by ['nextAppointment', patientID, date]. A close handler sets the state to false, and the render wires the fetched appointment and handlers into BottomSheetDialog.
Home component refactor
src/pages/home/home.tsx
Local appointment state and BottomSheetDialog wiring are removed; Home now renders <AppointmentBottomSheet /> directly and updates imports to remove unused state/dialog dependencies.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Suggested reviewers

  • Tamir198

Poem

🐇 Hop, extracted and clean,
AppointmentBottomSheet now gleams on the screen!
State once scattered, now held with care,
useQuery fetches with patient-friendly flair.
Home is lighter, refactored so bright — carrots and code aligned just right! 🥕

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'feat: 86extdm6t' is vague and non-descriptive, using what appears to be a random identifier rather than a meaningful description of the changes made in the pull request. Change the title to something descriptive like 'feat: integrate React Query for appointment data fetching' that clearly conveys the main change.
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed The description covers the main changes and notes backend testing limitations, but is missing the structured template sections like 'Related Issue(s)' and the checklist items required by the template.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch appointment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@rachelishteren rachelishteren requested a review from GilHeller June 14, 2026 20:18

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/pages/home/home.tsx`:
- Around line 40-44: The BottomSheetDialog component in the home component can
be closed via the onClose handler which sets selectedAppointment to false, but
there is no UI element that allows reopening it by setting selectedAppointment
back to true. Add a clickable UI element (such as an appointment card or button)
that calls setSelectedAppointment(true) when clicked to allow users to reopen
the dialog and access the appointment information again after closing it.
- Line 17: The selectedAppointment state is initialized to true, causing the
dialog to auto-open when the component mounts instead of waiting for user
interaction. Change the initial value of the selectedAppointment useState hook
from true to false so the dialog does not open automatically. Then add a UI
element such as a button or clickable card with an onClick handler that calls
setSelectedAppointment(true) to allow users to deliberately open the appointment
dialog when they choose to view their appointment.
- Around line 22-33: The useQuery hook for fetching the next appointment is only
destructuring the data property and ignoring isLoading and isError states.
Modify the destructuring in the useQuery call to also extract isLoading and
isError along with data, then add conditional rendering logic to display
appropriate loading indicators when isLoading is true and error messages or
fallback UI when isError is true, ensuring the user receives feedback during
slow API calls or when the appointment fetch fails.
- Around line 19-20: Replace the hardcoded patientID and date values in the home
component with dynamic, user-specific data to ensure data integrity and privacy.
First, complete the authentication implementation in useAuth.ts (address the
existing TODO) to provide authenticated user context. Then in home.tsx, replace
the hardcoded patientID constant with the actual patient identifier from the
authenticated user returned by useAuth, and replace the hardcoded date constant
with dynamic logic such as retrieving the current date or the next available
appointment date. This ensures each user sees only their own appointment data.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 49bf265b-8d9d-4e79-a845-018ce6823e74

📥 Commits

Reviewing files that changed from the base of the PR and between 74d158a and 51a0d00.

📒 Files selected for processing (1)
  • src/pages/home/home.tsx

Comment thread src/pages/home/home.tsx Outdated
chairNumber: 9,
treatmentNumber: 2,
status: 'confirmed',
const [selectedAppointment, setSelectedAppointment] = useState<boolean>(true)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Dialog auto-opens on mount due to initial true state.

Initializing selectedAppointment to true causes the dialog to attempt opening immediately when the component mounts, creating an auto-popup experience. Users typically expect dialogs to open in response to a deliberate action (e.g., clicking a button), not automatically on page load.

🔧 Recommended fix
-  const [selectedAppointment, setSelectedAppointment] = useState<boolean>(true)
+  const [selectedAppointment, setSelectedAppointment] = useState<boolean>(false)

Then add a UI element (e.g., a button or card click handler) that calls setSelectedAppointment(true) when the user wants to view their appointment.

📝 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
const [selectedAppointment, setSelectedAppointment] = useState<boolean>(true)
const [selectedAppointment, setSelectedAppointment] = useState<boolean>(false)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/pages/home/home.tsx` at line 17, The selectedAppointment state is
initialized to true, causing the dialog to auto-open when the component mounts
instead of waiting for user interaction. Change the initial value of the
selectedAppointment useState hook from true to false so the dialog does not open
automatically. Then add a UI element such as a button or clickable card with an
onClick handler that calls setSelectedAppointment(true) to allow users to
deliberately open the appointment dialog when they choose to view their
appointment.

Comment thread src/pages/home/home.tsx Outdated
Comment on lines +19 to +20
const patientID = '1622017'
const date = '07-06-2026'

Copy link
Copy Markdown

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:

#!/bin/bash
# Description: Find how user/patient ID is accessed elsewhere in the codebase

# Search for user context, auth context, or patient context patterns
rg -n -C3 --type=tsx --type=ts 'useUser|useAuth|usePatient|user.*context|patient.*context' -i

# Search for existing patterns of getting current user/patient ID
rg -n -C3 --type=tsx --type=ts 'currentUser|userId|patientId|patient.*id' -i | head -50

Repository: ColmanDevClubORG/Sagol360Management

Length of output: 135


🏁 Script executed:

# Read the home.tsx file to understand the context
cat -n src/pages/home/home.tsx | head -40

Repository: ColmanDevClubORG/Sagol360Management

Length of output: 1789


🏁 Script executed:

# Search for user/auth context patterns with corrected rg syntax
rg -n -C3 'useUser|useAuth|usePatient|useContext.*user|useContext.*auth' -t ts -t tsx

# Also search for how patientId/userId is typically accessed
rg -n -C3 'patient.*id|user.*id|currentUser' -t ts -t tsx | head -50

Repository: ColmanDevClubORG/Sagol360Management

Length of output: 135


🏁 Script executed:

# Check if there are any imports or hooks related to authentication in the codebase
fd -e ts -e tsx | xargs grep -l 'useAuth\|useUser\|user.*context' | head -20

Repository: ColmanDevClubORG/Sagol360Management

Length of output: 149


🏁 Script executed:

# Read the useAuth hook to understand how to access user context
cat -n src/hooks/useAuth.ts

Repository: ColmanDevClubORG/Sagol360Management

Length of output: 258


🏁 Script executed:

# Check ProtectedRoute to understand auth patterns
cat -n src/components/ProtectedRoute/ProtectedRoute.tsx

Repository: ColmanDevClubORG/Sagol360Management

Length of output: 380


🏁 Script executed:

# Search for other uses of patientID in the codebase to understand patterns
rg -n 'patientID|patientId' --max-count=20

Repository: ColmanDevClubORG/Sagol360Management

Length of output: 1163


🏁 Script executed:

# Look for user/session/auth context setup (try without type filters)
rg -n 'createContext|useContext|useState.*user|useState.*auth' | head -30

Repository: ColmanDevClubORG/Sagol360Management

Length of output: 61


Hardcoded test data must be replaced with dynamic user context and date logic.

These hardcoded values will cause all users to see the same appointment data (patient 1622017 on 07-06-2026), which is a critical data integrity and privacy issue. The authentication system is currently incomplete (see the TODO in useAuth.ts), but once it provides user context, patientID must be retrieved from the authenticated user instead of hardcoded here.

Before merging:

  • Implement proper user authentication in useAuth.ts to provide authenticated user/patient context
  • Replace the hardcoded patientID with the actual value from the authenticated user
  • Replace the hardcoded date with dynamic logic (e.g., current date or next available appointment date)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/pages/home/home.tsx` around lines 19 - 20, Replace the hardcoded
patientID and date values in the home component with dynamic, user-specific data
to ensure data integrity and privacy. First, complete the authentication
implementation in useAuth.ts (address the existing TODO) to provide
authenticated user context. Then in home.tsx, replace the hardcoded patientID
constant with the actual patient identifier from the authenticated user returned
by useAuth, and replace the hardcoded date constant with dynamic logic such as
retrieving the current date or the next available appointment date. This ensures
each user sees only their own appointment data.

Comment thread src/pages/home/home.tsx Outdated
Comment on lines 22 to 33
const { data: appointment } = useQuery({
queryKey: ['nextAppointment', patientID, date],
queryFn: async () => {
const response = await apiService.get<Appointment>('/api/appointment/nextAppointment', {
params: {
patientID,
date,
},
})
return response
},
})

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Add error and loading state handling for better user experience.

The query result is destructured to only data, ignoring isLoading and isError. If the API call is slow or fails, the user receives no feedback—the dialog simply never appears.

Consider destructuring and handling these states:

💡 Suggested enhancement
-  const { data: appointment } = useQuery({
+  const { data: appointment, isLoading, isError, error } = useQuery({
     queryKey: ['nextAppointment', patientID, date],
     queryFn: async () => {
       const response = await apiService.get<Appointment>('/api/appointment/nextAppointment', {
         params: {
           patientID,
           date,
         },
       })
       return response
     },
   })
+
+  if (isLoading) {
+    return <div>Loading appointment...</div> // Or a proper loading skeleton
+  }
+
+  if (isError) {
+    console.error('Failed to fetch appointment:', error)
+    // Show error UI or toast notification
+  }
📝 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
const { data: appointment } = useQuery({
queryKey: ['nextAppointment', patientID, date],
queryFn: async () => {
const response = await apiService.get<Appointment>('/api/appointment/nextAppointment', {
params: {
patientID,
date,
},
})
return response
},
})
const { data: appointment, isLoading, isError, error } = useQuery({
queryKey: ['nextAppointment', patientID, date],
queryFn: async () => {
const response = await apiService.get<Appointment>('/api/appointment/nextAppointment', {
params: {
patientID,
date,
},
})
return response
},
})
if (isLoading) {
return <div>Loading appointment...</div> // Or a proper loading skeleton
}
if (isError) {
console.error('Failed to fetch appointment:', error)
// Show error UI or toast notification
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/pages/home/home.tsx` around lines 22 - 33, The useQuery hook for fetching
the next appointment is only destructuring the data property and ignoring
isLoading and isError states. Modify the destructuring in the useQuery call to
also extract isLoading and isError along with data, then add conditional
rendering logic to display appropriate loading indicators when isLoading is true
and error messages or fallback UI when isError is true, ensuring the user
receives feedback during slow API calls or when the appointment fetch fails.

Comment thread src/pages/home/home.tsx Outdated
Comment on lines 40 to 44
<BottomSheetDialog
appointment={selectedAppointment}
isOpen={!!selectedAppointment}
onClose={() => setSelectedAppointment(undefined)}
appointment={appointment}
isOpen={selectedAppointment && !!appointment}
onClose={() => setSelectedAppointment(false)}
/>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical | 🏗️ Heavy lift

No mechanism to reopen the dialog after closing.

Once the user closes the dialog, selectedAppointment is set to false (line 43), but there is no UI element in this component that allows the user to set it back to true. This makes the appointment information inaccessible until the page is refreshed, breaking a core user workflow.

🔧 Recommended solution

Add a clickable UI element (e.g., an appointment card or "View Appointment" button) that calls setSelectedAppointment(true) when clicked. For example:

<AppointmentCard 
  appointment={appointment}
  onClick={() => setSelectedAppointment(true)}
/>

or

{appointment && (
  <button onClick={() => setSelectedAppointment(true)}>
    View Next Appointment
  </button>
)}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/pages/home/home.tsx` around lines 40 - 44, The BottomSheetDialog
component in the home component can be closed via the onClose handler which sets
selectedAppointment to false, but there is no UI element that allows reopening
it by setting selectedAppointment back to true. Add a clickable UI element (such
as an appointment card or button) that calls setSelectedAppointment(true) when
clicked to allow users to reopen the dialog and access the appointment
information again after closing it.

Comment thread src/pages/home/home.tsx Outdated
onClose={() => setSelectedAppointment(undefined)}
appointment={appointment}
isOpen={selectedAppointment && !!appointment}
onClose={() => setSelectedAppointment(false)}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

define a function outside the return and call it.

Comment thread src/pages/home/home.tsx Outdated
Comment on lines +19 to +20
const patientID = '1622017'
const date = '07-06-2026'

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Add a comment for MOCK DATA

Comment thread src/pages/home/home.tsx Outdated
const { data: appointment } = useQuery({
queryKey: ['nextAppointment', patientID, date],
queryFn: async () => {
const response = await apiService.get<Appointment>('/api/appointment/nextAppointment', {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

the URL path should be a constant

Comment thread src/pages/home/home.tsx Outdated
Comment on lines 22 to 33
const { data: appointment } = useQuery({
queryKey: ['nextAppointment', patientID, date],
queryFn: async () => {
const response = await apiService.get<Appointment>('/api/appointment/nextAppointment', {
params: {
patientID,
date,
},
})
return response
},
})

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

manage the appointment logic inside the component. This component should tell us what we will see in the HomePage with minimal logic as possible

Comment thread src/pages/home/home.tsx Outdated
onClose={() => setSelectedAppointment(undefined)}
appointment={appointment}
isOpen={selectedAppointment && !!appointment}
onClose={() => setSelectedAppointment(false)}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

consider to implement it inside the component and allow override or add extra logic to the onClose.

@rachelishteren rachelishteren requested a review from GilHeller June 18, 2026 18:08
@rachelishteren

Copy link
Copy Markdown
Collaborator Author

@GilHeller

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/pages/home/AppointmentBottomSheet/AppointmentBottomSheet.tsx`:
- Around line 17-21: In the apiService.get call for the Appointment endpoint,
the params object contains incorrect parameter names and format that don't match
the API contract. Change the parameter name from patientID to patientId in the
params object, and convert the date value to ISO format using the
formatIsoDate() function imported from datesUtils before passing it to the API.
This ensures the parameter names match the expected camelCase format and the
date is in the correct YYYY-MM-DD ISO format that the Appointment type
definition requires.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4857aef9-d1fb-4162-835f-136e67ce8c71

📥 Commits

Reviewing files that changed from the base of the PR and between 51a0d00 and 3cbf76b.

📒 Files selected for processing (3)
  • src/constants/api.constants.ts
  • src/pages/home/AppointmentBottomSheet/AppointmentBottomSheet.tsx
  • src/pages/home/home.tsx
✅ Files skipped from review due to trivial changes (1)
  • src/constants/api.constants.ts

Comment on lines +17 to +21
const response = await apiService.get<Appointment>(API_ENDPOINTS.appointment, {
params: {
patientID,
date,
},

@coderabbitai coderabbitai Bot Jun 18, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Endpoint usage =="
rg -n -C2 "API_ENDPOINTS\.appointment|nextAppointment"

echo
echo "== Param naming usage across TS/TSX =="
rg -n -C2 --type=ts --type=tsx '\bpatientID\b|\bpatientId\b|\bdate\b'

echo
echo "== Check OpenAPI/Swagger specs if present =="
spec_files="$(fd -i 'openapi|swagger' -e yml -e yaml -e json || true)"
if [ -n "${spec_files}" ]; then
  echo "${spec_files}" | xargs rg -n -C2 'nextAppointment|patientID|patientId|date|format:\s*date'
else
  echo "No OpenAPI/Swagger spec files found."
fi

Repository: ColmanDevClubORG/Sagol360Management

Length of output: 2726


🏁 Script executed:

# Read the file under review to see the full context around lines 12-21
cat -n src/pages/home/AppointmentBottomSheet/AppointmentBottomSheet.tsx | head -40

Repository: ColmanDevClubORG/Sagol360Management

Length of output: 1466


🏁 Script executed:

# Search for Appointment type definition
rg -n "type Appointment|interface Appointment" -A 10

Repository: ColmanDevClubORG/Sagol360Management

Length of output: 3033


🏁 Script executed:

# Search for patientID and patientId usage in the codebase
rg -n "patientID|patientId" --type ts

Repository: ColmanDevClubORG/Sagol360Management

Length of output: 1286


🏁 Script executed:

# Look for API service configurations and other endpoint calls
rg -n "apiService\.get\|apiService\.post" -A 5 -B 2

Repository: ColmanDevClubORG/Sagol360Management

Length of output: 61


🏁 Script executed:

# Search for API service implementation and how it handles responses
rg -n "apiService" -A 3 -B 1 src/services/

Repository: ColmanDevClubORG/Sagol360Management

Length of output: 300


🏁 Script executed:

# Check for any backend type definitions or API documentation
fd -type f -name "*.ts" -o -name "*.tsx" -o -name "*.json" | xargs rg -l "nextAppointment|/api/appointment"

Repository: ColmanDevClubORG/Sagol360Management

Length of output: 495


🏁 Script executed:

# Look for date formatting utilities or constants
rg -n "IsoDateString|date.*format" -B 2 -A 2

Repository: ColmanDevClubORG/Sagol360Management

Length of output: 3873


Parameter names and date format do not match the API contract—this query will fail silently.

The code sends patientID (line 19) and a non-ISO date '07-06-2026' (line 12), but the Appointment response type expects patientId (lowercase, typed as number) and date as IsoDateString (YYYY-MM-DD format, validated against IsoDateStringSchema). This mismatch will cause the endpoint to reject or ignore parameters, returning empty/incorrect data. Use patientId and convert the date to ISO format using formatIsoDate() from datesUtils.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/pages/home/AppointmentBottomSheet/AppointmentBottomSheet.tsx` around
lines 17 - 21, In the apiService.get call for the Appointment endpoint, the
params object contains incorrect parameter names and format that don't match the
API contract. Change the parameter name from patientID to patientId in the
params object, and convert the date value to ISO format using the
formatIsoDate() function imported from datesUtils before passing it to the API.
This ensures the parameter names match the expected camelCase format and the
date is in the correct YYYY-MM-DD ISO format that the Appointment type
definition requires.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@rachelishteren what do you think about that comment?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

👍 , I will take this offer.

const [selectedAppointment, setSelectedAppointment] = useState<boolean>(true)

const patientID = '1622017'
const date = '07-06-2026' // Mock data

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

const MOCK_DATE = '07-06-2026' instead the comment

Comment on lines +17 to +21
const response = await apiService.get<Appointment>(API_ENDPOINTS.appointment, {
params: {
patientID,
date,
},

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@rachelishteren what do you think about that comment?

@Tamir198

Copy link
Copy Markdown
Member

@rachelishteren also you have a small conflict

@rachelishteren rachelishteren requested a review from Tamir198 June 22, 2026 22:05
@rachelishteren

Copy link
Copy Markdown
Collaborator Author

@Tamir198

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants