Conversation
… default values for DailyQuiz
…culty, solved to Topic; create unique index on DailyQuiz
…z submissions by date
…x and remove optional answer field
…eve questions based on AI recommendations
…er quiz topics and progress
…missions and calculate scores
…ctions for courses and topics and tracks with server-side validation and aplly authntication middleware
Adds full CRUD functionality for user notes, including advanced filtering, sorting, and pagination.
…eve quiz submission days for a given month
…id question index
Adds full CRUD functionality for user notes, including advanced filtering, sorting, and pagination. Description: This pull request introduces the full backend implementation for the user notes feature, allowing learners to create, manage, and review personal notes associated with topics. Key Changes: Database: Added a Note model to the Prisma schema with relationships to User, Topic, and Course for efficient filtering. API Endpoints: Implemented a new set of RESTful endpoints under /api/notes and /api/topics/:topicId/notes for complete CRUD functionality. Business Logic: Created a dedicated note.service.ts to encapsulate all business logic, ensuring a clean separation of concerns. Validation: Integrated Zod schemas for rigorous validation of all incoming requests, including query parameters for advanced filtering, sorting, search, and pagination. Security: All new endpoints are protected and require user authentication. Authorization checks are in place to ensure users can only access and modify their own notes.
Apply authentication middleware and server-side validation, and implement a course, topic, and track endpoints with course-completion feature
Remove unused functions, update dependencies, and implement new features for quiz management, including tracking user submissions and enhancing the DailyQuiz and Topic models. Improve error handling and middleware configuration for better application stability.
- Restructured routes and controllers - Added comprehensive Postman collection with all API endpoints - Removed deprecated controller files - Added new service files for better organization - Updated schemas and middleware
There was a problem hiding this comment.
Pull Request Overview
This PR merges the 'dev' branch into main, introducing a comprehensive API and web application for an Open Learning Platform. The changes add complete functionality for tracks, courses, topics, notes, quizzes, and authentication systems.
- Implementation of RESTful API endpoints for learning platform features
- Frontend React components and services for user interaction
- Authentication system using better-auth with JWT tokens
- Database schema updates for notes and quiz functionality
Reviewed Changes
Copilot reviewed 52 out of 54 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| apps/web/src/services/* | API service modules for frontend-backend communication |
| apps/web/src/hooks/* | React Query hooks for data fetching and state management |
| apps/web/src/lib/* | Authentication client and route protection components |
| apps/api/src/services/* | Business logic services for API endpoints |
| apps/api/src/routes/* | Express route handlers for API endpoints |
| apps/api/src/schemas/* | Validation schemas using Zod |
| apps/api/prisma/* | Database schema and migration files |
| package.json files | Dependency updates for both frontend and backend |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| }); | ||
| }; | ||
|
|
||
| export const getToltalTopics = async ( |
There was a problem hiding this comment.
Function name contains a typo: 'getToltalTopics' should be 'getTotalTopics'.
| export const getToltalTopics = async ( | |
| export const getTotalTopics = async ( |
| }); | ||
| }; | ||
|
|
||
| export const getToltalTopics = async (courseId: string) => { |
There was a problem hiding this comment.
Function name contains a typo: 'getToltalTopics' should be 'getTotalTopics'.
| export const getToltalTopics = async (courseId: string) => { | |
| export const getTotalTopics = async (courseId: string) => { |
| import exprees from "express"; | ||
| const router = exprees.Router(); |
There was a problem hiding this comment.
Import statement contains a typo: 'exprees' should be 'express'.
| import exprees from "express"; | |
| const router = exprees.Router(); | |
| import express from "express"; | |
| const router = express.Router(); |
| async (req, res) => { | ||
| const course = await Service.getCourse(req.params.courseId); | ||
|
|
||
| const totalTopics = await Service.getToltalTopics(req.params.courseId); |
There was a problem hiding this comment.
Function call contains a typo: 'getToltalTopics' should be 'getTotalTopics'.
| async (req, res) => { | ||
| const { completed } = req.query; | ||
|
|
||
| const topics = await topicService.getToltalTopics( |
There was a problem hiding this comment.
Function call contains a typo: 'getToltalTopics' should be 'getTotalTopics'.
| const topics = await topicService.getToltalTopics( | |
| const topics = await topicService.getTotalTopics( |
| router.delete( | ||
| "/:topicId/completion", | ||
| requireAuth, | ||
| validate({ params: getTopicParamsSchema }), | ||
| async (req, res) => { | ||
| await unmarkTopicAsCompleted(req.user!.id, req.params.topicId); | ||
| res.enhancedSend(204, undefined); | ||
| }, | ||
| ); |
There was a problem hiding this comment.
The DELETE endpoint for topic completion should use POST method instead, as indicated by the frontend service which calls unMarkTopicAsCompleted via POST to /topics/${topicId}/uncompletion. This creates an API inconsistency.
| title: string; | ||
| content: string; | ||
| topicId: string; | ||
| userId: string; // موجود في schema |
There was a problem hiding this comment.
Comment contains non-English text. Code comments should be in English for consistency and maintainability in international teams.
| userId: string; // موجود في schema | |
| userId: string; // Present in schema |
No description provided.