Skip to content

Commit 7f24a32

Browse files
Version 0.9.0
1 parent 0808534 commit 7f24a32

File tree

88 files changed

+12102
-6783
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+12102
-6783
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ A modern React-based frontend application for a chiropractor clinic management s
1212
- **Backend Ready**: All endpoints integrated and tested with your Node.js backend
1313

1414
### 📋 Chat API Endpoints
15-
- `POST /v1/api/2025/conversations/doctor-patient` - Create doctor-patient chat
16-
- `GET /v1/api/2025/users/doctors` - Get available doctors
17-
- `POST /v1/api/2025/messages` - Send messages
18-
- `GET /v1/api/2025/conversations` - Get user conversations
19-
- `GET /v1/api/2025/conversations/:id/messages` - Get conversation messages
15+
- `POST /api/v1/2025/conversations/doctor-patient` - Create doctor-patient chat
16+
- `GET /api/v1/2025/users/doctors` - Get available doctors
17+
- `POST /api/v1/2025/messages` - Send messages
18+
- `GET /api/v1/2025/conversations` - Get user conversations
19+
- `GET /api/v1/2025/conversations/:id/messages` - Get conversation messages
2020

2121
## 🛠️ Tech Stack
2222

@@ -51,7 +51,7 @@ http://localhost:5173/chat-demo
5151
## 🔧 Configuration
5252

5353
The app is configured to work with your backend at:
54-
- **Development**: `http://localhost:3000/v1/api/2025`
54+
- **Development**: `http://localhost:3000/api/v1/2025`
5555
- **Production**: Configure in `src/services/baseApi.js`
5656

5757
## 📚 Documentation

package-lock.json

Lines changed: 29 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"@headlessui/react": "^2.2.2",
2121
"@heroicons/react": "^2.2.0",
2222
"@radix-ui/react-accordion": "^1.2.11",
23+
"@radix-ui/react-alert-dialog": "^1.1.14",
2324
"@radix-ui/react-avatar": "^1.1.10",
2425
"@radix-ui/react-checkbox": "^1.3.2",
2526
"@radix-ui/react-dialog": "^1.1.14",

src/api/config/config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
export const API_CONFIG = {
33
// Environment-specific base URLs
44
URLS: {
5-
development: 'http://localhost:3000/v1/api/2025',
6-
production: 'https://drdieuphanchiropractor.com/v1/api/2025',
7-
staging: 'http://staging.drdieuphanchiropractor.com/v1/api/2025',
5+
development: 'http://localhost:3000/api/v1/2025',
6+
production: 'https://drdieuphanchiropractor.com/api/v1/2025',
7+
staging: 'http://staging.drdieuphanchiropractor.com/api/v1/2025',
88
},
99

1010
// Request configuration

src/api/config/endpoints.js

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -17,31 +17,16 @@ export const API_ENDPOINTS = {
1717
PATIENTS: "/users/patients",
1818
},
1919

20-
// Reports & Forms
21-
REPORTS: {
22-
BASE: "/reports",
23-
TEMPLATES: "/templates",
24-
PATIENT_INTAKE: (reportId) => `/reports/${reportId}/patient-intake`,
25-
INSURANCE_DETAILS: (reportId) => `/reports/${reportId}/insurance-details`,
26-
PAIN_EVALUATION: (reportId) => `/reports/${reportId}/pain-evaluation`,
27-
DETAILED_DESCRIPTION: (reportId) =>
28-
`/reports/${reportId}/detailed-description`,
29-
WORK_IMPACT: (reportId) => `/reports/${reportId}/work-impact`,
30-
HEALTH_CONDITIONS: (reportId) => `/reports/${reportId}/health-conditions`,
31-
},
20+
// Deprecated: REPORTS section removed - now using INCIDENTS system
3221

33-
// Clinical Notes
34-
CLINICAL_NOTES: {
35-
BASE: "/clinical-notes",
36-
BY_PATIENT: (patientId) => `/clinical-notes/patient/${patientId}`,
37-
SOAP: "/clinical-notes/soap",
38-
},
22+
// Incidents & Forms
23+
INCIDENTS: {
24+
BASE: "/incidents",
25+
FORMS: (incidentId) => `/incidents/${incidentId}/`,
26+
SUBMIT_FORMS: (incidentId) => `/incidents/${incidentId}/submit-forms`,
27+
COMPLETE_FORMS: (incidentId) => `/incidents/${incidentId}/forms/complete`,
28+
NOTES: (incidentId) => `/incidents/${incidentId}/notes`,
3929

40-
// Vitals
41-
VITALS: {
42-
BASE: "/vitals",
43-
BY_PATIENT: (patientId) => `/vitals/patient/${patientId}`,
44-
LATEST: (patientId) => `/vitals/patient/${patientId}/latest`,
4530
},
4631

4732
// Appointments
@@ -54,7 +39,11 @@ export const API_ENDPOINTS = {
5439
// Chat
5540
CHAT: {
5641
BASE: "/chat",
57-
MESSAGES: (chatId) => `/chat/${chatId}/messages`,
42+
CONVERSATIONS: "/chat/conversations",
43+
CONVERSATION_MESSAGES: (conversationId) => `/chat/conversations/${conversationId}/messages`,
44+
CONVERSATION_USERS: "/chat/conversations/users",
45+
SEND_MESSAGE: "/chat/messages",
46+
AVAILABLE_USERS: "/chat/staff-admin-doctors",
5847
},
5948

6049
// Blog

src/api/index.js

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,43 @@ export {
6565
useApproveTimeOffRequestMutation,
6666
useGetDoctorConflictsQuery,
6767
useGetScheduleStatisticsQuery,
68-
} from './services/doctorScheduleApi';
68+
} from './services/doctorScheduleApi';
69+
70+
// Report/Incident API exports
71+
export {
72+
reportApi,
73+
useCreateIncidentMutation,
74+
useGetIncidentsQuery,
75+
useGetIncidentByIdQuery,
76+
useUpdateIncidentMutation,
77+
useDeleteIncidentMutation,
78+
useSaveIncidentFormMutation,
79+
useUpdateIncidentFormMutation,
80+
useAddIncidentNoteMutation,
81+
useGetCompleteIncidentFormsQuery,
82+
useSubmitIncidentFormsMutation,
83+
useGetIncidentFormQuery,
84+
// Simple form submission hooks
85+
useSubmitPatientInfoFormMutation,
86+
useSubmitHealthInsuranceFormMutation,
87+
useSubmitPainDescriptionFormNewMutation,
88+
useSubmitPainAssessmentFormNewMutation,
89+
useSubmitMedicalHistoryFormNewMutation,
90+
useSubmitLifestyleImpactFormNewMutation,
91+
} from './services/reportApi';
92+
93+
// Chat API exports
94+
export {
95+
chatApi,
96+
useCreateConversationMutation,
97+
useGetConversationUsersQuery,
98+
useGetConversationsQuery,
99+
useGetConversationQuery,
100+
useUpdateConversationStatusMutation,
101+
useDeleteConversationMutation,
102+
useGetMessagesQuery,
103+
useSendMessageMutation,
104+
usePollForNewMessagesQuery,
105+
useGetMessageStatusQuery,
106+
useGetAvailableUsersQuery,
107+
} from './services/chatApi';

src/api/services/appointmentApi.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { createApi } from "@reduxjs/toolkit/query/react";
22
import { baseQueryWithReauth, CACHE_TIMES } from "../core/baseApi";
3-
import { cacheUtils } from "../../utils/cache";
43

54
export const appointmentApi = createApi({
65
reducerPath: "appointmentApi",
@@ -29,12 +28,12 @@ export const appointmentApi = createApi({
2928
}),
3029

3130
getDoctorAvailability: builder.query({
32-
query: ({ doctorId, date }) => {
31+
query: ({ doctor_id, date }) => {
3332
const queryParams = new URLSearchParams();
3433
if (date) queryParams.append("date", date);
3534

3635
return {
37-
url: `appointments/doctors/${doctorId}/availability?${queryParams}`,
36+
url: `appointments/doctors/${doctor_id}/availability?${queryParams}`,
3837
method: "GET",
3938
};
4039
},
@@ -53,7 +52,6 @@ export const appointmentApi = createApi({
5352
async onQueryStarted(arg, { dispatch, queryFulfilled }) {
5453
try {
5554
await queryFulfilled;
56-
cacheUtils.appointments.clearAll();
5755
} catch (error) {
5856
console.error("Failed to create appointment:", error);
5957
}
@@ -66,11 +64,14 @@ export const appointmentApi = createApi({
6664
const queryParams = new URLSearchParams();
6765

6866
if (params.status) queryParams.append("status", params.status);
67+
if (params.status_not) queryParams.append("status_not", params.status_not);
68+
if (params.date_from) queryParams.append("date_from", params.date_from);
69+
if (params.date_to) queryParams.append("date_to", params.date_to);
6970
if (params.page) queryParams.append("page", params.page.toString());
7071
if (params.limit) queryParams.append("limit", params.limit.toString());
7172

7273
return {
73-
url: `appointments/`,
74+
url: `appointments/?${queryParams}`,
7475
method: "GET",
7576
};
7677
},
@@ -80,16 +81,17 @@ export const appointmentApi = createApi({
8081

8182
// Get patient's appointments by patient ID
8283
getPatientAppointments: builder.query({
83-
query: ({ patientId, ...params }) => {
84+
query: ({ patient_id, ...params }) => {
8485
const queryParams = new URLSearchParams();
8586

8687
if (params.status) queryParams.append("status", params.status);
8788
if (params.date_from) queryParams.append("date_from", params.date_from);
89+
if (params.date_to) queryParams.append("date_to", params.date_to);
8890
if (params.page) queryParams.append("page", params.page.toString());
8991
if (params.limit) queryParams.append("limit", params.limit.toString());
9092

9193
return {
92-
url: `appointments/patient/${patientId}?${queryParams}`,
94+
url: `appointments/patient/${patient_id}?${queryParams}`,
9395
method: "GET",
9496
};
9597
},
@@ -103,7 +105,10 @@ export const appointmentApi = createApi({
103105
const queryParams = new URLSearchParams();
104106

105107
if (params.status) queryParams.append("status", params.status);
108+
if (params.status_not) queryParams.append("status_not", params.status_not);
106109
if (params.doctor_id) queryParams.append("doctor_id", params.doctor_id);
110+
if (params.date_from) queryParams.append("date_from", params.date_from);
111+
if (params.date_to) queryParams.append("date_to", params.date_to);
107112
if (params.page) queryParams.append("page", params.page.toString());
108113
if (params.limit) queryParams.append("limit", params.limit.toString());
109114

@@ -137,7 +142,6 @@ export const appointmentApi = createApi({
137142
async onQueryStarted({ id }, { dispatch, queryFulfilled }) {
138143
try {
139144
await queryFulfilled;
140-
cacheUtils.appointments.clearAll();
141145
} catch (error) {
142146
console.error("Failed to update appointment:", error);
143147
}
@@ -153,7 +157,6 @@ export const appointmentApi = createApi({
153157
async onQueryStarted(id, { dispatch, queryFulfilled }) {
154158
try {
155159
await queryFulfilled;
156-
cacheUtils.appointments.clearAll();
157160
} catch (error) {
158161
console.error("Failed to delete appointment:", error);
159162
}
@@ -174,7 +177,6 @@ export const appointmentApi = createApi({
174177
async onQueryStarted({ id }, { dispatch, queryFulfilled }) {
175178
try {
176179
await queryFulfilled;
177-
cacheUtils.appointments.clearAll();
178180
} catch (error) {
179181
console.error("Failed to reschedule appointment:", error);
180182
}
@@ -198,4 +200,4 @@ export const {
198200
} = appointmentApi;
199201

200202
// Legacy compatibility exports
201-
export const useCreateQuickAppointmentMutation = useCreateAppointmentMutation;
203+

src/api/services/blogApi.js

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,15 @@ export const blogApi = createApi({
1515
query: (params = {}) => {
1616
const queryParams = new URLSearchParams();
1717

18+
// New status-based filtering (replaces published parameter)
19+
if (params.status) queryParams.append("status", params.status);
1820
if (params.category) queryParams.append("category", params.category);
19-
if (params.published !== undefined) queryParams.append("published", params.published.toString());
2021
if (params.page) queryParams.append("page", params.page.toString());
2122
if (params.limit) queryParams.append("limit", params.limit.toString());
23+
if (params.search) queryParams.append("search", params.search);
24+
if (params.tag) queryParams.append("tag", params.tag);
25+
if (params.sort_by) queryParams.append("sort_by", params.sort_by);
26+
if (params.sort_order) queryParams.append("sort_order", params.sort_order);
2227

2328
return {
2429
url: `blog/posts?${queryParams}`,
@@ -69,6 +74,42 @@ export const blogApi = createApi({
6974
}),
7075
invalidatesTags: ["BlogPosts"],
7176
}),
77+
78+
// Publish blog post (change is_published to true)
79+
publishBlogPost: builder.mutation({
80+
query: (id) => ({
81+
url: `blog/posts/${id}`,
82+
method: "PUT",
83+
body: { is_published: true },
84+
}),
85+
invalidatesTags: (result, error, id) => [
86+
{ type: "BlogPosts", id },
87+
"BlogPosts",
88+
],
89+
}),
90+
91+
// Get public blog posts (no authentication required, only published posts)
92+
getPublicBlogPosts: builder.query({
93+
query: (params = {}) => {
94+
const queryParams = new URLSearchParams();
95+
96+
// Public endpoint - no status parameter needed (backend handles this)
97+
if (params.category) queryParams.append("category", params.category);
98+
if (params.page) queryParams.append("page", params.page.toString());
99+
if (params.limit) queryParams.append("limit", params.limit.toString());
100+
if (params.search) queryParams.append("search", params.search);
101+
if (params.tag) queryParams.append("tag", params.tag);
102+
if (params.sort_by) queryParams.append("sort_by", params.sort_by);
103+
if (params.sort_order) queryParams.append("sort_order", params.sort_order);
104+
105+
return {
106+
url: `blog/posts?${queryParams}`,
107+
method: "GET",
108+
};
109+
},
110+
providesTags: ["BlogPosts"],
111+
keepUnusedDataFor: CACHE_TIMES.LONG,
112+
}),
72113
}),
73114
});
74115

@@ -78,6 +119,8 @@ export const {
78119
useGetBlogPostByIdQuery,
79120
useUpdateBlogPostMutation,
80121
useDeleteBlogPostMutation,
122+
usePublishBlogPostMutation,
123+
useGetPublicBlogPostsQuery,
81124
} = blogApi;
82125

83126
// Legacy exports for backward compatibility

0 commit comments

Comments
 (0)