-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rating feature implementation #538
Open
mthani2
wants to merge
45
commits into
ScottyLabs:main
Choose a base branch
from
mthani2:rating-feature-backend
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains 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
…ies and email input as first addition
…dropdown with all of the restaurants of CMUeats website
…restaurant to a friend
…dding a new Rating sysystem page
- Added backend functionality to calculate and fetch average ratings - Integrated frontend logic to display average ratings on eatery cards - Encountered some errors related to module imports and TypeScript definitions
… average rating functionalities
…, and average rating calculations
…e interactions in unit tests
…folder, in which I created feedbackController.js. Implemented core functions for managing feedback, including create, read, update, and delete operations. Structured the controller to integrate with the feedback model and routes.Added basic validation and error handling to ensure robust feedback processing.
…data using Mongoose. Included fields for user information, feedback content, timestamps, and associated references, ensuring appropriate data validation and default values. This model serves as the foundation for storing and managing feedback records in the database.
…ng middleware for JSON parsing, CORS handling, and logging. Integrated route handling for API endpoints and established a connection to the database using Mongoose. Configured the server to listen on a specified port, ensuring a functional entry point for the backend application.
…e and export a reusable email transporter using Nodemailer. Included setup for SMTP settings, authentication, and default sender information to streamline email-sending functionality across the application. Ensured flexibility for future enhancements, such as template integration or additional email providers.
…tainability and scalability
…mueats into rating-feature-backend
…d handling all ratings per restaurant.
…averaging ratings
This reverts commit 27ee003.
the commit. This ensures the comprehensivness of the rating feature, integrating the backend, frontend and testing.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@mthani2 is attempting to deploy a commit to the ScottyLabs Team on Vercel. A member of the Team first needs to authorize it. |
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.
Description
This pull request integrates the rating system feature, including backend endpoints, frontend functionality, and comprehensive testing. The feature enables users to submit ratings for restaurants in a newly added form page titled "Rate a Restaurant" and dynamically updates the displayed average ratings on restaurant cards (planned functionality). While the form is functional and most routes are written, the dynamic updates for the average rating on the eatery cards are not yet operational, as the cards still display "no rating" even after submission.
Motivation: The rating system enhances user interaction and feedback collection, allowing restaurants to monitor and improve their services based on real-time user reviews.
Review System feature: encompassing backend endpoints, frontend functionality, and the review submission flow. The feature allows users to leave detailed feedback for restaurants, including comments on food, service, and cleanliness, as well as an option to recommend the restaurant to others. The feedback is sent via email to the respective restaurant's email address, enabling restaurant managers to review and act on user feedback.
The Review System is accessible through a new "Leave a Review" button added to the navigation bar, which routes users to the ReviewFormPage. The form is fully functional, allowing for email submission, dropdown-based restaurant selection, and feedback input file. (#472)
Motivation: The review system enhances the CMUEats platform by offering a streamlined way for users to provide feedback to restaurants. This feature empowers restaurants to improve their services based on real user experiences and fosters better engagement between the dining establishments and their customers.
Dependencies:
Rating: No new external dependencies were introduced.
Review: This feature introduces Nodemailer as a new dependency to handle email delivery functionality.
Closes #360
and
Closes #472
Type of change
How Has This Been Tested?
Comprehensive testing was implemented to validate the feature:
Unit Tests for Rating: Tested the RatingModel methods to ensure data processing, such as creating, fetching, and calculating averages, functions correctly.
Integration Tests: Validated the backend endpoints (POST, GET, and average rating calculations) to ensure seamless communication between the frontend and backend.
Error Handling Tests: Verified server responses for invalid requests or edge cases.
Manual Testing: The feature was tested manually to verify user interactions, API calls, and dynamic updates on the frontend.
Unit Tests for Review:
Backend Testing:
Verified the feedbackController.js endpoints for CRUD operations, ensuring they process user-submitted feedback accurately.
Tested the emailTransporter.js utility to confirm successful email delivery with valid inputs.
Manual testing was performed using Mailtrap to simulate email delivery and debug authentication issues during development.
Frontend Testing:
Conducted manual testing of the review form on desktop browsers (Chrome, macOS Ventura) to verify input validation, submission flow, and error handling.
Checked dropdown functionality for restaurant selection and ensured email mapping correctness.
Integration Testing:
Validated the end-to-end flow from form submission on the frontend to email delivery via the backend.
Error Handling:
Tested various edge cases, such as invalid email formats and empty required fields, to ensure proper error messages are displayed.
Test Configuration:
Node.js version: 18.x
Desktop/Mobile: Desktop
OS: macOS Ventura
Browser: Chrome
Checklist:
Future Directions:
Resolve the issue with dynamically updating average ratings on eatery cards. While the backend is fully operational and returns accurate responses, the frontend is not yet reflecting the changes after a new rating is submitted.
--> Consider integrating a persistent database for ratings storage instead of the current in-memory database for scalability.