Skip to content

Feature/mail#95

Merged
aditya241104 merged 8 commits into
mainfrom
feature/mail
Nov 15, 2025
Merged

Feature/mail#95
aditya241104 merged 8 commits into
mainfrom
feature/mail

Conversation

@aditya241104

@aditya241104 aditya241104 commented Nov 15, 2025

Copy link
Copy Markdown
Collaborator

Project

  • QuickClinic
  • QuickMed

Change Type

  • New Feature/Page/API Endpoint
  • Bug Fix
  • UI Redesign
  • Optimization
  • Other

Stack

  • Frontend
  • Backend
  • Both

Page Type

  • Public
  • Patient
  • Doctor
  • Admin

Route/API Endpoint Status

  • New
  • Existing

What Changed

Route/API Affected

Description

Screenshots (If Applicable)

image

Code Quality

  • Prettier syntax check passed (npx prettier --check .)

Related Issues

Closes #94

Summary by CodeRabbit

  • New Features

    • Users now receive welcome email upon registration.
    • Appointment confirmation emails sent when bookings are made.
    • Status update emails sent when appointment status changes.
    • Prescription notification emails sent with prescription details.
  • Style

    • Minor UI adjustments to image sizing and layout formatting.
  • Chores

    • Updated email service dependency.

@vercel

vercel Bot commented Nov 15, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
quick-clinic Ready Ready Preview Comment Nov 15, 2025 10:50am
quick-clinic-m9k7 Ready Ready Preview Comment Nov 15, 2025 10:50am

@aditya241104 aditya241104 merged commit eaa04f9 into main Nov 15, 2025
5 of 6 checks passed
@aditya241104 aditya241104 deleted the feature/mail branch November 15, 2025 10:50
@coderabbitai

coderabbitai Bot commented Nov 15, 2025

Copy link
Copy Markdown
Contributor

Caution

Review failed

The pull request is closed.

Walkthrough

Email notification system integrated across authentication, appointment, and prescription workflows. Server-side controllers now send confirmation and status emails via refactored emailService. Email configuration updated to parse environment variables. Minor UI styling adjustments applied to dashboard components.

Changes

Cohort / File(s) Summary
Client UI Styling
client/src/components/Patient/PatientDashboard/HeroSection.jsx, client/src/components/Patient/PatientProfile/BasicInformation.jsx
Image sizing constraint changed from width:auto to width:100%; whitespace formatting adjusted
Email Service Core
server/services/emailService.js, server/config/email.js
Email service refactored with new function signatures (sendWelcomeEmail, sendAppointmentBookedEmail, sendAppointmentStatusEmail, sendPrescriptionEmail); config now parses EMAIL_PORT, EMAIL_SECURE from environment and conditionally includes auth credentials
Dependencies
server/package.json
nodemailer upgraded from ^7.0.3 to ^7.0.10
Controller Email Integration
server/Controllers/authController.js, server/Controllers/appointmentController.js, server/Controllers/patientController.js, server/Controllers/prescriptionController.js
Email notifications added to registration, appointment booking/status updates, and prescription creation; patient controller modified to always populate userId for email retrieval; appointment controller expanded to handle status updates

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant AuthController
    participant EmailService
    participant Email Provider

    Client->>AuthController: POST /register (email, password, role)
    AuthController->>AuthController: Validate & create user
    AuthController->>AuthController: Generate tokens
    activate AuthController
        AuthController->>EmailService: sendWelcomeEmail(email, userName, role)
        EmailService->>Email Provider: Send welcome email
        Email Provider-->>EmailService: Sent (async, non-blocking)
        EmailService-->>AuthController: Returns info
    deactivate AuthController
    AuthController-->>Client: Return tokens & user data
Loading
sequenceDiagram
    participant Client
    participant AppointmentController
    participant EmailService
    participant Email Provider

    Client->>AppointmentController: POST /book (appointmentData)
    AppointmentController->>AppointmentController: Create appointment
    AppointmentController->>AppointmentController: Populate user/doctor/clinic data
    activate AppointmentController
        AppointmentController->>EmailService: sendAppointmentBookedEmail(patientEmail, appointmentDetails)
        EmailService->>Email Provider: Send confirmation email
        Email Provider-->>EmailService: Sent (async)
        EmailService-->>AppointmentController: Returns info
    deactivate AppointmentController
    AppointmentController-->>Client: Return appointment
Loading
sequenceDiagram
    participant Client
    participant AppointmentController
    participant EmailService
    participant Email Provider

    Client->>AppointmentController: PUT /update (appointmentData, status)
    AppointmentController->>AppointmentController: Update appointment with status
    AppointmentController->>AppointmentController: Populate updated data
    alt Status provided
        activate AppointmentController
            AppointmentController->>EmailService: sendAppointmentStatusEmail(patientEmail, appointmentDetails, newStatus)
            EmailService->>Email Provider: Send status change email
            Email Provider-->>EmailService: Sent (async)
            EmailService-->>AppointmentController: Returns info
        deactivate AppointmentController
    end
    AppointmentController-->>Client: Return updated appointment
Loading
sequenceDiagram
    participant Client
    participant PrescriptionController
    participant EmailService
    participant Email Provider

    Client->>PrescriptionController: POST /create (prescriptionData)
    PrescriptionController->>PrescriptionController: Create & link prescription
    PrescriptionController->>PrescriptionController: Fetch populated prescription with patient email
    activate PrescriptionController
        PrescriptionController->>EmailService: sendPrescriptionEmail(patientEmail, prescriptionDetails)
        EmailService->>Email Provider: Send prescription email
        Email Provider-->>EmailService: Sent (async, non-blocking on errors)
        EmailService-->>PrescriptionController: Returns info
    deactivate PrescriptionController
    PrescriptionController-->>Client: Return prescription
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Key areas requiring attention:
    • server/services/emailService.js — Substantial refactor with multiple function signature changes; verify all callers align with new parameter shapes (appointmentDetails, prescriptionDetails objects)
    • server/Controllers/appointmentController.js — Status update handling and nested population logic; ensure email is sent only when status is provided and patient email is available
    • server/Controllers/prescriptionController.js — Enhanced error handling and populated query construction; confirm email sending doesn't block main response and failures are logged
    • server/config/email.js — Environment variable parsing logic; validate EMAIL_SECURE string comparison and EMAIL_PORT integer fallback
    • Cross-controller consistency — Verify all four controllers (auth, appointment, patient, prescription) correctly populate related user/email fields before calling emailService

Possibly related PRs

Suggested labels

enhancement

Poem

🐰 Hops and whiskers, mail takes flight,
Welcome notes and status right,
Prescriptions penned with care so deep,
Appointments confirmed while patients sleep,
EmailService hops through code so neat,
Making notifications quite sweet! 📧

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/mail

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 637d703 and edef7f8.

⛔ Files ignored due to path filters (3)
  • client/src/assets/Jeet_Krupali.png is excluded by !**/*.png
  • client/src/assets/Verified_Clinics.png is excluded by !**/*.png
  • server/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (9)
  • client/src/components/Patient/PatientDashboard/HeroSection.jsx (1 hunks)
  • client/src/components/Patient/PatientProfile/BasicInformation.jsx (0 hunks)
  • server/Controllers/appointmentController.js (4 hunks)
  • server/Controllers/authController.js (2 hunks)
  • server/Controllers/patientController.js (2 hunks)
  • server/Controllers/prescriptionController.js (4 hunks)
  • server/config/email.js (1 hunks)
  • server/package.json (1 hunks)
  • server/services/emailService.js (1 hunks)

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 and usage tips.

@github-actions

Copy link
Copy Markdown

📋 PR Auto-Check

📝 Files Changed

client/src/assets/Jeet_Krupali.png
client/src/assets/Verified_Clinics.png
client/src/components/Patient/PatientDashboard/HeroSection.jsx
client/src/components/Patient/PatientProfile/BasicInformation.jsx
server/Controllers/appointmentController.js
server/Controllers/authController.js
server/Controllers/patientController.js
server/Controllers/prescriptionController.js
server/config/email.js
server/package-lock.json
server/package.json
server/services/emailService.js

✨ Code Quality

Prettier Check: ✅ Passed


Auto-generated on 2025-11-15T10:50:23.100Z

@github-actions

Copy link
Copy Markdown

📋 PR Auto-Check

📝 Files Changed

client/src/assets/Jeet_Krupali.png
client/src/assets/Verified_Clinics.png
client/src/components/Patient/PatientDashboard/HeroSection.jsx
client/src/components/Patient/PatientProfile/BasicInformation.jsx
server/Controllers/appointmentController.js
server/Controllers/authController.js
server/Controllers/patientController.js
server/Controllers/prescriptionController.js
server/config/email.js
server/package-lock.json
server/package.json
server/services/emailService.js

✨ Code Quality

Prettier Check: ✅ Passed


Auto-generated on 2025-11-15T10:52:17.500Z

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.

feature(mail):add mail feature

1 participant