Feature/booking system - #49
Merged
Merged
Conversation
- Fixed Counselor.ts: Changed ref from 'User' to 'users' - Fixed Booking.ts: Changed ref from 'User' to 'users' - Fixed Progress.ts: Changed ref from 'User' to 'users' - Fixed Reminder.ts: Changed ref from 'User' to 'users' - Fixed Journal.ts: Changed ref from 'User' to 'users' These fixes ensure proper MongoDB population by using the correct registered model name.
- Modified getBookingById(): First find booking, then check ownership separately - Returns 403 Forbidden if user doesn't own the booking - Returns 404 Not Found if booking doesn't exist - Updated booking controller to handle 403 status code - Added same access control to cancelBooking() This ensures proper distinction between 'not found' and 'access denied' scenarios.
- Modified cancelBooking() to fetch booking without populate first - Checks ownership before attempting cancellation - Calls markSlotAsAvailable() with raw counselorId string - Returns populated booking in response for client context - Improved error handling in slot marking methods - Enhanced markSlotAsBooked() and markSlotAsAvailable() with try-catch This ensures slots are properly freed when bookings are cancelled.
- Added custom signUp endpoint for testing (POST /api/auth/register)
- Generates base64-encoded JSON tokens: {id, email, name, role}
- Updated isAuth middleware to support dual auth modes
- Tries BetterAuth sessions first, falls back to base64 tokens
- Decodes and validates base64 tokens against database user
- Registered /api/auth/register route in app.ts
This allows testing without BetterAuth while maintaining production compatibility.
- Added User model import for potential future use - Fixed specialty filter to use MongoDB operator - Specialty filter now correctly matches array elements - Improved error logging for debugging - Handles both 'specializations' and 'specialty' query parameters - Filter supports both single values and comma-separated lists This ensures specialty filtering works correctly across all counselor queries.
- Add responsive grid layout: 1 column on mobile, 2 on tablet+ - Make BookingModal fully responsive with stacked layout on mobile - Improve CounselorCard footer layout for mobile screens - Add responsive padding and text sizing across components - Hide filter sidebar on mobile, show on desktop (lg breakpoint) - Fix time slot grid to 2 columns on mobile, 3 on tablet+ - Update page container with mobile-first padding scheme - Enhance success toast responsiveness with better sizing
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Kavinduk2
approved these changes
Mar 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces several new features and improvements to the backend of the recovery system, mainly focused on counselor and booking functionality, as well as enhancements to user authentication and seeding scripts. The most significant changes include new endpoints for booking counseling sessions, expanded counselor query capabilities, a custom sign-up endpoint for testing, and a script to seed counselor data. Minor improvements were also made to response handling for consistency.
Counselor and Booking Functionality
booking.controller.ts) with endpoints for creating, retrieving, and cancelling bookings, as well as managing counselor availability slots. This enables users to book sessions and counselors to manage their schedules.Counselor.controller.ts) with endpoints to fetch all counselors (with filters) and retrieve individual counselor profiles, supporting more flexible queries and improved data access.Authentication and User Management
signUp) inauth.controller.tsand registered it inapp.ts, allowing user registration for testing purposes. [1] [2] [3]auth.controller.tsby ensuring all responses usereturn res.json(...)for clarity and maintainability. [1] [2] [3]Data Seeding
seed-counselors.ts) to seed the database with test counselors, their profiles, and available slots, facilitating development and testing.Minor Improvements
return res.status(...).json(...)for consistency. [1] [2]Routing Enhancements
app.tsto enable the booking endpoints.These changes collectively enhance the backend's support for counseling and booking workflows, improve developer experience, and ensure more robust and consistent API responses.