Skip to content
Merged
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
1 change: 1 addition & 0 deletions src/constants/api.constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ export const API_ENDPOINTS = {
patient: '/api/patients/',
metrics: '/api/metrics/',
metricsToday: '/api/metrics/today/',
appointment: '/api/appointment/nextAppointment',
email: '/api/email',
}
6 changes: 6 additions & 0 deletions src/constants/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import { formatIsoDate } from '@/utils/datesUtils'

export const DOT = '•'
export const METRIC_MAX_VALUE = '10'
export const SLIDER_MIN_VALUE = 1
export const SLIDER_MAX_VALUE = 10
export const BALANCE_VIDEO_TIME = 15
export const STRETCH_VIDEO_TIME = 10
export const MOCK_DATA = {
patientID: Number('1622017'),
date: formatIsoDate(new Date(2026, 5, 23)),
}
39 changes: 39 additions & 0 deletions src/pages/home/AppointmentBottomSheet/AppointmentBottomSheet.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { useQuery } from '@tanstack/react-query'
import { BottomSheetDialog } from '@/components/BottomSheetDialog/BottomSheetDialog'
import { apiService } from '@/services/api/api.service'
import { useState } from 'react'
import type { Appointment } from '@/components/BottomSheetDialog/types'
import { API_ENDPOINTS } from '@/constants/api.constants'
import { MOCK_DATA } from '@/constants'

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

const patientid = MOCK_DATA.patientID
const date = MOCK_DATA.date

const { data: appointment } = useQuery({
queryKey: ['nextAppointment', patientid, date],
queryFn: async () => {
const response = await apiService.get<Appointment>(API_ENDPOINTS.appointment, {
params: {
patientid,
date,
},
Comment on lines +18 to +22

@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.

})
return response
},
})

const handleCloseBottomSheet = () => {
setSelectedAppointment(false)
}

return (
<BottomSheetDialog
appointment={appointment}
isOpen={selectedAppointment && !!appointment}
onClose={handleCloseBottomSheet}
/>
)
}
21 changes: 2 additions & 19 deletions src/pages/home/home.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import { useState } from 'react'
import { ProgressCard } from '@/pages/home/progress/ProgressCard'
import { BottomSheetDialog } from '@/components/BottomSheetDialog/BottomSheetDialog'
import type { Appointment } from '@/components/BottomSheetDialog/types'
import { DailyTips } from './dailyTips/DailyTips'
import { CheckIn } from './checkIn/CheckIn'
import { HomeButtomDesktop, HomeButtomMobile, HomeTopDesktop, HomeTopMobile } from './styles'
Expand All @@ -10,29 +7,15 @@ import { SGLTypography } from '@/components/UI/Typography/SGLTypography'
import { useTranslation } from 'react-i18next'
import { useIsMobile } from '@/hooks/useIsMobile'
import { Welcome } from './welcome/Welcome'
import { AppointmentBottomSheet } from './AppointmentBottomSheet/AppointmentBottomSheet'

export const Home = () => {
const [selectedAppointment, setSelectedAppointment] = useState<Appointment | undefined>({
appointmentId: '1',
patientId: 1622017,
time: '10:12:50',
date: '2026-05-15',
chamber: 'appointment.chamber.hyperbaric',
chairNumber: 9,
treatmentNumber: 2,
status: 'confirmed',
})

const { t } = useTranslation()
const isMobile = useIsMobile()

return (
<>
<BottomSheetDialog
appointment={selectedAppointment}
isOpen={!!selectedAppointment}
onClose={() => setSelectedAppointment(undefined)}
/>
<AppointmentBottomSheet />
<div style={isMobile ? HomeTopMobile : HomeTopDesktop}>
<Welcome />
<ProgressCard value={10} />
Expand Down
Loading